Im wondering what I am doing wrong:
- Create xib and add on it UIView "FirstView".
- Under this UIView "FirstView" add another UIView "SecondView".
- On the FirstViewController load SecondView from nib.
it works at this point. What开发者_JAVA技巧s not working is that the "FirstView" doesnt seem to change after point 3. So the "SecondView" is properly loaded by not visible on "FirstView".
I hope it is clear enough.
I'm just going to take a guess at what you might be doing wrong.
If you specify the inner SecondView in Interface Builder then SecondView view will be created and added as a subview by the nib loading code. If you then load another nib from your code and simply assign the resulting secondview to the outlet then it won't be added as a subview of FirstView unless you specifically add it in code, and the original SecondView will still be there.
I think if you want to do this in Interface Builder you'll need to load SecondView as a UIViewController that's placed inside the FirstView, then specify the nib to load in that SecondView view controller.
精彩评论