0

我似乎无法推动这个视图控制器,我一定做错了什么。代码

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
button = [UIButton buttonWithType:UIButtonTypeCustom];
[button addTarget:self action:@selector(pushToStart) forControlEvents:UIControlEventTouchUpInside];
}

- (void)pushToStart
{
ViewController *view = [[ViewController alloc]init];

[[self navigationController] pushViewController:view animated:YES];

}

我究竟做错了什么?

4

1 回答 1

1

以编程方式创建 UINavigationController,或者使用 Interface Builder 来创建 - 网上有 100 多个关于如何做到这一点的教程。例如这里

于 2012-08-13T19:14:57.243 回答