views:

24

answers:

1

Im wondering what I am doing wrong:

  1. Create xib and add on it UIView "FirstView".
  2. Under this UIView "FirstView" add another UIView "SecondView".
  3. On the FirstViewController load SecondView from nib.

it works at this point. Whats 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.

+1  A: 

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.

Nimrod