Sunday, 15 May 2011

objective c - How to navigate from subview to other view controller? -



objective c - How to navigate from subview to other view controller? -

assume having 1 view controller called mainpage(this rootviewcontroller). in view controller , adding 1 sub view.

see below :

firstpage1=[[firstpage alloc] initwithnibname:@"firstpage" bundle:[nsbundle mainbundle]]; [self.view addsubview:firstpage1.view];

in subview , need navigate next page.

so have used presentviewcontroller below code doen't worked well.

see below code:

[self.view.window.rootviewcontroller presentviewcontroller:anotherviewcontroller animated:yes completion:nil];

it works on first time if called next time , got below error.

error : view not in window hierarchy!

having separate view controllers beingness linked utilize uinavigationcontroller. create uinavigationcontroller , add together view self.view on example. then, [navcontroller pushviewcontroller: animated:] each view needed. or pop lastly view controller, force new 1 if don't want old pages accessible. how project seems set up, that's easiest way.

objective-c uinavigationcontroller pushviewcontroller addsubview presentviewcontroller

No comments:

Post a Comment