美文网首页
iOS view内进行push或present界面跳转

iOS view内进行push或present界面跳转

作者: liuzhongyi | 来源:发表于2018-05-24 17:59 被阅读508次

最近梳理了一下如何在view内进行界面的跳转方法

1.代理方法实现。不做多余的说明了。

2.Block方法实现。同样不多说了。

3.看代码

4.采用AppDelegate实现(在需要实现跳转的view(testView.m)里写下如下代码)

//1view present

    FirstViewController *jump = [[FirstViewController alloc]init];

    AppDelegate *app1 = (AppDelegate *)[UIApplication sharedApplication].delegate;

    [app1.window.rootViewController presentViewController:jump animated:YES completion:nil];

    //2view push

    FirstViewController *jump = [[FirstViewController alloc]init];

    AppDelegate *app2 = (AppDelegate *)[UIApplication sharedApplication].delegate;

    UINavigationController *navi = (UINavigationController *)app2.window.rootViewController;

    [navi pushViewController:jump animated:YES];

相关文章

网友评论

      本文标题:iOS view内进行push或present界面跳转

      本文链接:https://www.haomeiwen.com/subject/jjfrrttx.html