ios 滑动返回 pop
来源:互联网 发布:太原知达常青藤好进吗 编辑:程序博客网 时间:2024/04/30 15:21
interactivePopGestureRecognizer
是iOS7推出的解决VeiwController
滑动后退的新功能,虽然很实用,但是坑也很多啊,用过的同学肯定知道问题在哪里,所以具体问题我就不描述了,这里只给出如何完美解决interactivePopGestureRecognizer
卡住的问题.
当然我们要自定义UINavigationController来解决这个问题:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
#import "MMNavController.h"@interface MMNavController (){ }@end@implementation MMNavController- (id)initWithRootViewController:(UIViewController *)rootViewController{ self = [super initWithRootViewController:rootViewController]; if (self) { // Custom initialization } return self;}- (void)viewDidLoad{ if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.interactivePopGestureRecognizer.delegate = (id)self; } }- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{ if ( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] && animated == YES ) { self.interactivePopGestureRecognizer.enabled = NO; } [super pushViewController:viewController animated:animated]; }- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated{ if ( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] && animated == YES ) { self.interactivePopGestureRecognizer.enabled = NO; } return [super popToRootViewControllerAnimated:animated]; }- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated{ if( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] ) { self.interactivePopGestureRecognizer.enabled = NO; } return [super popToViewController:viewController animated:animated]; }#pragma mark UINavigationControllerDelegate- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animate{ if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.interactivePopGestureRecognizer.enabled = YES; }}-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{ if ( gestureRecognizer == self.interactivePopGestureRecognizer ) { if ( self.viewControllers.count < 2 || self.visibleViewController == [self.viewControllers objectAtIndex:0] ) {
//跟试图控制器页面 return NO; } } return YES;}
0 0
- ios 滑动返回 pop
- iOS POP返回总结
- iOS 自定义滑动返回和解决连续多次push,pop引起的crash问题
- iOS pop返回时崩溃
- iOS 滑动返回
- ios滑动返回
- iOS实现滑动返回
- iOS滑动返回问题
- iOS手势滑动返回
- iOS 滑动返回功能
- iOS 边缘滑动返回
- iOS左侧滑动返回
- iOS滑动返回
- iOS全屏滑动返回
- iOS 全屏滑动返回
- iOS向右滑动返回
- iOS全屏滑动返回
- ios 滑动返回 系统滑动返回
- activiti 排他网管(七)
- 《失控》(凯文·凯利)读书分享
- UVA 11300 Spreading the Wealth(技巧:中位数 推公式)
- Java再学习-java集合(二)
- ScrollView下,ListView重复调用getview解决方案
- ios 滑动返回 pop
- hdoj2011 (java)多项式求和
- 《CSS3实战》笔记--渐变设计(一)
- c++的灵魂,类的书写的一些看法
- 谈谈低延迟对音质的负面影响,顺便谈谈WASAPI
- std::for_each
- Android getWidth和getMeasuredWidth 区别
- Taglist: Exuberant ctags (http://ctags.sf.net) not found in PATH. Plugin is not loaded.
- listView设置条目分隔线