Creating an iPhone app from an Android app, UIViews or UIViewControllers?
I'm quite new in iPhone programming. I'm the only objective-c programmer of my company, and I have to create an app almost done 开发者_如何学运维for android but for iPhone.
I have 2 basic questions. The app has a lot of screens, a big hierarchy of views and buttons to move between the views.
Question 1: As I need a back button to go back to the previous view, is it a good idea to have like 30 or 40 view controllers and have a back button by using the UINavigationController? Or it would be better to have around 6 or 7 view controllers with many views for each view controller? [This question is made also thinking about memory management]
And Question 2: in the case that the best choice would be have 6 view controllers with many views for each view controller, how can I implement a back button as if it would be an Android app (or a UINavigationController but for UIViews)??
Thank you very much for your answers in advance, I know that memory management is a very important issue in the iPhone programming, a problem that my work-mates (android programmers) don't have, and the back button, another big problem for me depending on the way of programming the app.
Thanks a lot!!
You should have one view controller for each "screen" of content.
For the most part, the key is going to be controlling memory yourself, and ensuring that you're releasing content that doesn't need to be used at a given time. Careful maintenance of your objects should limit any memory issues you're going to have, even with numerous controllers pushing and popping from the stack.
In terms of how many controllers you should use, this is going to vary. Any screens that duplicate functions in a basic way (editing a single text field, displaying an image, etc) can usually share controllers with a little property magic worked on them before you push them.
If each of your screens is very unique, however, then having a number of view controllers won't hurt you at all.
精彩评论