UIViewController连续push、pop的正确做法
来源:互联网 发布:maya导入unity3d 编辑:程序博客网 时间:2024/04/29 21:07
正确的做法是把 连续的push放在上一个push的结束回调 navigationController:didShowViewController:animated:中进行
@interface PbNavigationController : UINavigationController <UINavigationControllerDelegate>@property (nonatomic,copy) dispatch_block_t completionBlock;@property (nonatomic,strong) UIViewController * pushedVC;@end@implementation PbNavigationController- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.delegate = self; } return self;}- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated { NSLog(@"didShowViewController:%@", viewController); if (self.completionBlock && self.pushedVC == viewController) { self.completionBlock(); } self.completionBlock = nil; self.pushedVC = nil;}-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { if (self.pushedVC != viewController) { self.pushedVC = nil; self.completionBlock = nil; }}-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(dispatch_block_t)completion { self.pushedVC = viewController; self.completionBlock = completion; [self pushViewController:viewController animated:animated];}@end
see also:
http://stackoverflow.com/questions/7674958/when-using-a-uinavigationcontroller-the-viewwillappear-or-viewdidappear-methods
http://stackoverflow.com/questions/22045098/didshowviewcontroller-not-being-called-after-viewdidappear
0 0
- UIViewController连续push、pop的正确做法
- UIViewController Push & Pop 的那些坑
- 栈的push、pop序列是否正确
- pop push UIViewController 手势过渡动画
- 笔试题:判断栈的push(),pop()序列是否正确
- 判断在UIViewController中,viewWillDisappear的时候是push还是pop出来
- 判断在UIViewController中,viewWillDisappear的时候是push还是pop出来
- iOS 自定义滑动返回和解决连续多次push,pop引起的crash问题
- 仰卧起坐的正确做法
- 堆栈的push, pop操作...
- 栈的push、pop序列
- 栈的push,pop序列
- 栈的push、pop序列
- 栈的push、pop序列
- 栈的push、pop序列
- 栈的push、pop序列
- 栈的push、pop序列
- 栈的push、pop序列
- UVA291_The House Of Santa Claus(DFS)
- Android平台上做一个完美的音乐频谱--Music Audio Glow
- opencv操作每个像素
- [LeetCode]Longest Consecutive Sequence
- Unreal SDK 游戏开发从入门到精通视频教程
- UIViewController连续push、pop的正确做法
- 剑指offer面试题10
- Sublime Text常用快捷命令整理
- android设备计算密度,宽高!
- 每日算法之十四:3Sum
- 扩展欧几里得求最小非负整数解 (POJ 1061 青蛙约会为例)
- 月黑风高克刚回来
- 64位windows 7操作系统下安装oracle client
- 用微笑面对明天