alo*_*oko 10 iphone uiviewcontroller uinavigationcontroller ios segue
在我们UIViewController一个接一个的三个s的iOS应用程序中,我们想根据某些条件跳过中间的一个,直接从第一个到第三个.但是,用户应该能够通过第三个控制器上的"后退"按钮返回第二个.
我试图[self performSegueWithIdentifier:@"segueId" sender:sender];从viewDidLoad,viewWillAppear但这破坏了导航栏,由调试日志指示.调用此代码viewDidAppear工作正常,但第二个视图已经显示,这是我首先想要避免的.
我也试过[self.navigationController pushViewController:vc animated:NO];但结果是同样损坏的导航栏,即使这次调试日志没有这样的条目.
这样做的支持方式是什么(如果可能的话)?
目标是带有iOS 5.1的iPhone4,开发环境是Xcode 4.3.
我在应用程序中使用以下代码.完全按预期工作.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
SecondViewController *secondVC = [self.storyboard instantiateViewControllerWithIdentifier:@"DetailViewController"];
if (indexPath.row == 0) {
// skip second vc
ThirdViewController *thirdVC = [self.storyboard instantiateViewControllerWithIdentifier:@"ThirdViewControllerViewController"];
[self.navigationController pushViewController:secondVC animated:NO];
[self.navigationController pushViewController:thirdVC animated:YES];
}
else {
// push second vc
[self.navigationController pushViewController:secondVC animated:YES];
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3283 次 |
| 最近记录: |