【发布时间】:2012-06-16 11:01:25
【问题描述】:
我是 iPhone 开发者的新手。
我想用动画导航到新页面,但我无法导航到新页面,
这是我的代码 sn-p,
UIButton *Planbtn = (UIButton *)[self.view viewWithTag:1];
[Planbtn addTarget:self action:@selector(btnClicked) forControlEvents:UIControlEventTouchUpInside];
..
-(void)btnClicked{
NSLog(@"btnClicked");
PlanPage *yourViewController = [[PlanPage alloc] initWithNibName:@"PlanPage" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:yourViewController animated:TRUE];
[yourViewController release];
}
我可以在我的日志中看到btnClicked。
提前致谢!
【问题讨论】:
-
您需要将 btnClicked 链接到您的界面事件出口
-
发布更多细节,您是否也在实施
UINavigationController? -
如果你看到 NSLog,我想你链接了你的 iBoutlet。所以也许你的 navigationController 是 nil 因为没有初始化。
-
查看我的编辑,我在我的项目中只添加了这么多代码,我还需要添加什么吗?
-
重要的是要知道你的rootViewController是否有导航控制器。您可以拥有一个有或没有它的应用程序,因此您的应用程序很可能不是基于导航的应用程序
标签: iphone animation navigation uibutton buttonclick