Iphone sdk - please help , 1 view takes me 45 minutes to do :(
I've been working on a Cook Book App but each view ( or recipie page) takes about 45 minutes to complete so as you can imagine its taking forever.
The problem is that I have to manually:
Set up a gradient image for the back ground (Somtimes I have to add a few image backgrounds to fit the view as I often 开发者_Go百科use a scroll view, not sure how this could be automated?)
Put an image behind the titles "Recipe name" , "Time needed" and an image to go behind the recipie instructions ( again I might need a few of these depending on how long the description is.
Creating view controllers for main sections such as "Breakfast" and "Lunch" and then I need to manually create view controllers to go in these sections.
Theres got to be a way to set up a template for this?
Thanks for reading all of this.
Thanks guys for all this great info, I now understand the process.
The problem is im not sure how to implement this from a coding aspect, is there a good tutorial I could read on this?
Are you creating a different view for EACH recipe? if so that sounds like a lot of work. I would utilize a database, a .plist, or some kind of data source to keep the recipe data. Then I would create template views for the recipes and load the data into each view.
I'm not sure I understand your struggle so I might be stating the obvious.
You should create you app in the model-view-controller way. This is the way almost every iPhone application is made. You can read about it in almost all getting started guides.
This way of creating your app would allow you to have a template for recipes, that you could load into an array. The array would be displayed in a UINavigationController, that would create a UITableView, with your array. When the user taps on an item, another view would be loaded with the data of the recipe.
In this way you would only need your Recipe class, your UINavigationController class, and your RecipeView class.
The application I worked on was a little simpler, since it only consisted of about five nibs, but I found it very helpful to create a ViewController-base-class, which took care of things like setting the background, handling some touch events etc ..., that were common to ll the Views.
Despite the title, this is the perfect tutorial to do exactly what you want and it explains how to do it in code. Disregard the UITableViewController
usage; you can create the parent view however you want, the important part is passing the child view data.
I found it when I had just started programming and it helped immensely. It's the Scary Bugs Programming Tutorial. You could also check out Apple's TheElements sample project for a more elaborate and already implemented code base. Hope this helps! If it does, remember to upvote :)
精彩评论