In my current application I wanted to use a a xib file for a sub-portion of a screen and re use it in other screens as well.
I loaded a UIView from xib and added it to another UIView which would act as a VC for it.
and that view will be used as a fragment of UI to be used at multiple places.
However, I found this to be a stop gap arrangement which breaks MVC, why is a View handling what a Controller should and also even if everything is handleed by one VC, that VC starts looking like a GOD object.
Then I found that in iOS5 there is a concept of child view controllers for portions of UI.
Has anyone used them ? Is it similar to the concept of fragments in Android ?
Yes, I’ve used them, and they’re easy to use, especially if you use storyboards. Whether they’re like fragments in Android, I can’t say.
In a storyboard, you can just add a container view (from the objects list), and that will automatically create an embed segue to another controller whose view will be the same size as the container view’s size. That controller will be instantiated by the system (no code on your part) when the controller that contains the container view is.