Multiple on-screen view controllers in iPhone apps
Posted
by Felixyz
on Stack Overflow
See other posts from Stack Overflow
or by Felixyz
Published on 2010-03-28T16:23:04Z
Indexed on
2010/03/28
19:53 UTC
Read the original article
Hit count: 300
I'm creating a lot of custom views and controllers in a lot of my apps and so far I've mostly set them up programmatically, with adjustments and instantiations being controlled from plists. However, now I'm transitioning to using Interface Builder as much as possible (wish I had done that before, was always on my back-list).
Apple is recommending against having many view controllers being simultaneously active in iPhone apps, with a couple of well-known exceptions. I've never fully understood why it should be bad to have different parts of the interface belong to different controllers, if they have no interdependent functionality at all.
Does having multiple controllers risk messing up the responder chain, or is there some other reason that it's not recommended, except for the fact that it's usually not needed?
What I want to be able to do is design reusable views and controls in IB, but since a nib is not associated with a view, but with a view controller, it seems I'd have to have different parts of the screen be connected to different controllers. I know it's possible to have other objects than view controllers being instantiated from nibs. Should I look into how to create my own alternative more light-weight controllers (that could be sub-controllers of a UIViewController) which could be instantiated from nibs?
© Stack Overflow or respective owner