视图控制器不会被推动

时间:2012-08-13 18:58:16

标签: objective-c ios xcode cocoa-touch

我似乎无法推动这个视图控制器,我必须做错事。代码

- (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];

}

我做错了什么?

1 个答案:

答案 0 :(得分:1)

以编程方式创建UINavigationController,或使用Interface Builder进行创建 - 有100个关于如何执行此操作的教程。例如here