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

2018-05-24  本文已影响508人  liuzhongyi

最近梳理了一下如何在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];

上一篇 下一篇

猜你喜欢

热点阅读