开发者

iphone navigation push problems

开发者 https://www.devze.com 2023-02-06 03:53 出处:网络
I use two buttons in UIViewController and the UIViewcontroller is included navigationcontroller. And I use below code, want to load tableview.

I use two buttons in UIViewController and the UIViewcontroller is included navigationcontroller.

And I use below code, want to load tableview.

-(IBAction)page2Pressed
{

 page2View *page2 = [[page2View alloc] initWithNibName:@"page2View" bundle:nil];

 page2.title = @"page2";

 [self.navigationController setNavigationBarHidden:NO animated:NO];

 [self.navigationController pushViewController:page2 animated:YES];

 [page2 release];
}

-(IBAction)page3Pressed
{ 
 page2View *page3 = [[page2View alloc] initWithNibName:@"page2View" bundle:nil];

 page3.title = @"page3";

 [self.navigationController setNavigationBarHidden:NO animated:NO];

 [self.navigationController pushViewController:page3 animated:YES];

 [page3 release];
}
开发者_如何学JAVA

in the page2pressed action, the Navigationcontroller can load page2view (tableview), but page3pressed action, navigationcontroller can't load page2view correctly.

when page3pressed done, the application load page2 and page3,

So, in page3pressed action, push event is occurred twice.. home -> page2 -> page3..

Can I solve this problem? I want to use one "page2View" respectively..

please give some answer


check in interface builder if your button is not attached with the two action methods i.e. page3Pressed, and also page2Pressed

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号