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

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容