跳转View方法小结
本文中所涉及的具体实例是在自己做的小实验的基础之上,下图为实验项目中涉及本主题的主要文件目录:
此处为了便于叙述,将BIDMasterViewController.h对应的主视图记做A, 跳转的目的视图BIDDetailViewController.h对应的视图记做视图B;
1 使用纯代码进行跳转:
//下面两句是获取参与跳转的页面A和
B
UIStoryboard *board=[UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
BIDDetailViewController *next=[board instantiateViewControllerWithIdentifier:@"detailViewController"];
[self.navigationController pushViewController:next animated:YES];
注: @ " "中的字符串是在UI中对应界面的identity,设置位置如下图:2. 在UI中直接在两个要跳转的界面间建立一个segue,有以下几种:
[self presentModalViewControll er:next animated:YES];
b 根据Segue Identifier 跳转
[self
c. 弹出一个ViewController 相当于返回上一个界面