IOS学习之——各种页面的跳转

来源:互联网 发布:数据库架构师工资 编辑:程序博客网 时间:2024/06/16 05:07

IOS页面中有以下几种页面跳转方式

1、VC和VC之间跳转

<span style="font-size:24px;">//跳转过去[self presentViewController:VC2 animated:YES completion:nil]//返回    [self </span><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size:18px;">dismissViewControllerAnimated:YES completion:nil];</span></span>


<strong style="font-size:24px; font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 51);"></strong>

 2、vc和Navigation之间跳转

<pre name="code" class="objc">跳转的代码ViewController2 *vc2 = [[ViewController2 alloc]init];        [self.navigationController presentViewController:vc2 animated:YES completion:nil];//返回的代码 [self.navigationController dismissViewControllerAnimated:YES completion:nil];

];



3、navigation跳转到下一个页面

 //跳转
[self.navigationController pushViewController:vc2 animated:YES]    //返回[self.navigationController popToRootViewControllerAnimated:YES]



4、navigation跳转到另外一个navigation




//跳转ViewController2 *vc2 = [[ViewController2 alloc]init];    UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:vc2];    //从当前导航控制器 调到 另外的导航控制器    [self.navigationController presentViewController:navigationController animated:YES completion:nil];//返回[self.navigationController dismissViewControllerAnimated:YES completion:nil];


0 0
原创粉丝点击