ios - Loading a View Controller inside a View In Xcode -


i current developing app in ipad. app consist of 2 views, each view contains lot of buttons , labels. current, layout of 2 views set. each 1 set in view controller. have view controller contains main menu on top , big container(uiview) in hope able hold 2 views mentioned.

my question is, there way show view controller inside view? want display 1 view controller inside container(uiview) when click on button in main menu, , display when click on button. if plan not possible please make suggestions make same thing work.

many thanks!

yes can adding uiviewcontroller view below..

_viewcontroller=[self.storyboard instantiateviewcontrollerwithidentifier:@"viewcontroller"]; [self.view addsubview:viewcontroller.view]; 

as add viewcontroller.view viewdidload method inside viewcontroller gets called.

update: per uiviewcontroller class reference need add 2 more steps when adding uiviewcontroller subview inside viewcontroller.

[self addchildviewcontroller:viewcontroller]; [self.view addsubview:viewcontroller.view]; [viewcontroller didmovetoparentviewcontroller:self]; 

the above completes answer.

hope helps. cheers.


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -