views:

133

answers:

3

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

+1  A: 

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

Paul Scott
Thanks for that, but I meant more along the lines of if I have a view for a single project that I use often such as a recipie page in my cookbook how can I set it up so that I only need to add the text and it will automatically go to the appropriate parts of the recipie page.
Dave
+2  A: 

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.

luvieere
Thanks very much :)
Dave
You're welcome!
luvieere
+1  A: 

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.

TechZen