I have a view where I added a view2 in xib (with interface builder), i joined everything with my viewClass. Everything is working.
But when I do in viewDidLoad :
view2 = [[[OtherViewController alloc]initWithNibName:@"OtherViewController" bundle:nil]view];
I still have my view but i don't have the outlets from OtherViewController view. I have to do :
[self.view addSubview:view2]; // It works, i see my outlets
Can someone tell me why ? And how can i do ? I need to add the OtherViewCOntroller view without using addSubview.
TY
You can do this if you are using
storyboard
, there is aContainer View
that you can add as subview, and connect that container view to yourOtherViewController
by anEmbedSegue
(if you are using iOS 6.0 or above). In this case you would not need any additional code to write.