2011-02-15 99 views
0

我想在ipad上实现下面的GUI。一个ViewController转到另一个ViewController

当用户启动我的应用程序时,我有一个ViewController,它具有按钮,用户触摸一个按钮后,它将转到另一个View Controller。

我的问题是如何在当前的ViewController中显示一个新的ViewController。

感谢

回答

1

您需要定义在头一个IBAction和你的按钮连接到这个动作。

然后在你的行动,使用方法:

/* also add - (IBAction) goToAnotherView: (id) sender; to your header */ 
- (IBAction) goToAnotherView: (id) sender { 

    MySecondViewController *secondView = [[MySecondViewController alloc] init]; 
    [self.navigationController pushViewController:secondView animated:YES]; 
    [secondView release]; 

} 
+0

我加了上面的代码在我的应用程序,但仍然无法正常工作。还有其他代码需要修改吗? – cs221313 2011-02-15 09:07:28

相关问题