iphone - PushViewController to navigate to next stack -


i new ios .what doing placed uibutton on main view , want when click on button t should take me next stack . doing

-(ibaction)stack:(id)sender{  page1 *button =[[page1 alloc]init];  [self.navigationcontroller pushviewcontroller:button animated:yes]; } 

i add in code ...but not working.

do need put uinavigationcontroller in main view or in appdelegate press button , create new stack navigation

in appdelegate,

self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"viewcontroller" bundle:nil]; self.window.rootviewcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:self.viewcontroller]; 

and change button press method,

-(ibaction)stack:(id)sender{     page1 *button =[[page1 alloc] initwithnibname:@"page1" bundle:nil];     [self.navigationcontroller pushviewcontroller:button animated:yes]; } 

Comments