Iphone sdk - 如何设置“模板”

发布于 2024-09-01 03:40:06 字数 204 浏览 6 评论 0原文

我一直在开发一个烹饪书应用程序,我一直在单独制作每个页面,这需要很长时间才能完成,我问了一个与此类似的问题,这引起了我的注意,您可以设置一种自动化的方法设计过程中,您所需要做的就是输入数据。

有人可以尽可能详细地解释一下如何设置 xcode 文件/代码来自动执行这样的过程

例如我只需输入页面文本,它会自动将我的标准背景图片放入并添加滚动视图和适当的按钮等 谢谢

I've been working on a Cook Book App and I've been making each page individually which takes a really long time to do, I asked a question similar to this and it was brought to my attention that you can setup a way to automate the design process so all you need to do is input your data.

Can someone please explain in as much detail as possible how you setup your xcode files/code to automate such a process

So for example I would just enter the page text and it would automatically put my standard background picture in and add a scroll view and appropriate buttons etc.
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

余生再见 2024-09-08 03:40:06

您可以制作一个主视图,其中包含您需要的所有控件:标准背景图片、滚动视图、适当的按钮等,并使您创建的任何后续视图继承自该视图,以便它们都包含这些控件。

您还可以仅使用一个视图并使用它的多个实例,每页一个实例。只需确保其上有一个 Text 属性,或者有一个接受文本字符串的构造函数,以便您可以将其设置为每个页面上的不同文本。

You could make one master view that contains all the controls that you need: standard background picture, scroll view, appropriate buttons, etc, and make any subsequent views that you create inherit from this view, so that they all contain those controls.

You could also use just one view and work with multiple instances of it, one instance per page. Just make sure to have a Text property on it, or a constructor that takes in your text string, so that you could set it to a different text on each page.

北音执念 2024-09-08 03:40:06

Xcode 项目模板和文件模板非常容易制作,但有一些注意事项。

检查这些问题的答案:
在 Xcode 中添加新模板
更改 XCode 中的模板

另请参阅这些方便的教程:
自定义 Xcode 模板
Xcode:如何自定义现有项目模板

Xcode project templates and file templates are pretty easy to make, with a few caveats.

Check the answers to these questions:
Add new templates in Xcode
Change templates in XCode

Also take a gander at these handy tutorials:
Custom Xcode Templates
Xcode: How to customize the existing project templates

彩虹直至黑白 2024-09-08 03:40:06

在我看来,这就像您将数据放入视图(页面)中。这是一个很大的设计错误。您需要采用模型-视图-控制器设计模式并将数据与视图分开。这将使创建一个视图(模板)变得容易,您可以重新加载数据以显示每个单独的食谱。

要做的第一件事是将数据与视图分离。您需要将食谱存储在数组、字典、核心数据等中,然后将该数据包装在专用对象中。要做的第二件事是创建一个专用视图来显示所有食谱。当用户从一个菜谱移动到另一个菜谱时,应用程序将根据需要简单地删除信息并将信息添加到同一视图中。

我会推荐Mac OS X 的可可食谱:佛蒙特州食谱,第二版,因为它解决了这些问题并且它使用食谱类型应用程序作为示例。它适用于 Cocoa,但基本原则也适用于 iPhone 应用程序。

It sounds to me like your putting your data into your views (pages). That's a big design error. You need to employ the Model-View-Controller design pattern and separate your data from your views. That will make it easy to create one view (template) that you can reload with data to display each individual recipe.

The first thing to do is to separate your data from the view. You need to have the recipes stored in an array, dictionary, Core Data etc and then wrap that data in a dedicated object. The second thing to do is to create a dedicated view to display all the recipes. As the user moves from recipe to recipe the app will simply remove and add information to the same view as needed.

I would recommend Cocoa Recipes for Mac OS X: The Vermont Recipes, Second Edition because it addresses these issues and it uses a recipe type app as its example. It's for Cocoa but the basic principles apply to iPhone apps as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文