码迷,mamicode.com
首页 > 移动开发 > 详细

ios导航控制器UINavigationController,控制器a跳转(push)到b后,b跳转(push)到c,但c后退(pop)进入a

时间:2017-05-31 14:20:33      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:retain   index   push   entity   nim   font   code   question   nav   

參考:StackOverflow

ios导航控制器UINavigationController,控制器a跳转(push)到b后,b跳转(push)到c。但c后退(pop)进入a。

b跳转(push)到c中代码书写例如以下:

     UINavigationController *navController = [[self.navigationController retain] autorelease];
     [navController popViewControllerAnimated:NO];
     ViewControllerC *_viewController = [[[ViewControllerC alloc] init] autorelease];
     [navController pushViewController:_viewController animated:YES];

代码解析

    // self.navigationController(...,ViewControllerA、ViewControllerB)
    // navController(nil)
    UINavigationController *navController = [[self.navigationController retain] autorelease];
    // self.navigationController(...,ViewControllerA、ViewControllerB)
    // navController(...,ViewControllerA、ViewControllerB)
    [navController popViewControllerAnimated:NO];
    // self.navigationController(nil)
    // navController(...,ViewControllerA)

    ViewControllerC * _viewController = [[[ViewControllerC alloc] init] autorelease];
    _viewController.messageEntity = [self.listArray objectAtIndex:indexPath.row];
    
    // self.navigationController(nil)
    // navController(...,ViewControllerA)
    [navController pushViewController:_viewController animated:YES];
    // self.navigationController(nil)
    // navController(...,ViewControllerA、ViewControllerC)


ios导航控制器UINavigationController,控制器a跳转(push)到b后,b跳转(push)到c,但c后退(pop)进入a

标签:retain   index   push   entity   nim   font   code   question   nav   

原文地址:http://www.cnblogs.com/jzdwajue/p/6923562.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!