首页 > 其他 > 详细

IOS 7 Study - Manipulating a Navigation Controller’s Array of View

时间:2014-02-20 22:31:46      阅读:394      评论:0      收藏:0      [点我收藏+]

Problem
You would like to directly manipulate the array of view controllers associated with a
specific navigation controller


Solution
Use the viewControllers property of the UINavigationController class to access and
modify the array of view controllers associated with a navigation controller

 

bubuko.com,布布扣
- (void) goBack {
    /* Get the current array of View Controllers */
    NSArray *currentControllers = self.navigationController.viewControllers;

    /* Create a mutable array out of this array */
    NSMutableArray *newControllers = [NSMutableArray
                                      arrayWithArray:currentControllers];

    /* Remove the last object from the array */
    [newControllers removeLastObject];

    /* Assign this array to the Navigation Controller with animation */
    [self.navigationController setViewControllers:newControllers
        animated:YES];
}
bubuko.com,布布扣

IOS 7 Study - Manipulating a Navigation Controller’s Array of View

原文:http://www.cnblogs.com/davidgu/p/3557309.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!