【发布时间】:2014-12-11 06:58:27
【问题描述】:
我以编程方式创建了一个 UIBarButtonItem,并希望它在被推送时转到下一个 ViewController。
这就是我在 viewDidLoad 中创建自定义 UIBarButtonItem 的方式:
UIBarButtonItem *foundButton = [[UIBarButtonItem alloc]
initWithTitle:@"Found it!"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(foundView)];
之后我创建了这个方法:
-(void)foundView:(id)sender {
UIViewController *foundVC = [self.storyboard instantiateViewControllerWithIdentifier:@"foundView"];
[self.navigationController pushViewController:foundVC animated:YES];
}
点击 UIBarButtonItem 后我想去的 ViewController 有一个 Storyboard ID:“foundView”。
我在这里做错了什么?
【问题讨论】:
标签: ios iphone objective-c uiviewcontroller