iOS UI 页面的跳转方法

来源:互联网 发布:景甜面相分析知乎 编辑:程序博客网 时间:2024/06/05 06:16

1.是通过拉控件页面A的UIButton 拉到页面B

2.是通过指定连线(segue)的名字跳转

//[self performSegueWithIdentifier:@"segue name" sender:nil   ];

//这种法类似于拖控件但是要在连线上 标上Identify

3.通过Storyboard创建一个对象弹出

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];(name 为storyboard的name)

ViewControllerB *vcB = [storyboard instantiateViewControllerWithIdentifier:@"vcB"];

[self presentViewController:vcB animated:YES completion:nil]; //弹出模太窗口

4.用XIB弹出

ViewControllerB  *vcB = [[ViewControllerB alloc]initWithNibName:@"ViewControllerB" bundle:ni]; //如果控制器的名字和xib同名就不用写withnibname了

[self presentViewController:vcB animated:YES completion:nil]; //弹出模太窗口

5.手写代码
ViewControllerB *vcB = [[ViewControllerB alloc]init];
[self presentViewController:@"vcB" animated:YES completion:nil];


0 0