問題 : 最近在在app一級(jí)頁面進(jìn)行系統(tǒng)左側(cè)右滑返回的時(shí)候,經(jīng)常出現(xiàn)界面卡死,只能回到手機(jī)首頁,再進(jìn)入app才能繼續(xù)操作app。
解決方法:?app一級(jí)頁面,大家都知道再返回是沒有任何相關(guān)的頁面,由于這個(gè)原因造成頁面卡死,所以現(xiàn)在在一級(jí)頁面分別添加禁用和開啟右滑返回手勢。
@property(nonatomic, assign)BOOL ?isCanUseSideBack;// 手勢是否啟動(dòng)
-(void)viewDidAppear:(BOOL)animated{
? ? ? ? ?[superview DidAppear:animated];
? ? ? ? [self cancelSideBack];
}
-?(void)viewDidDisappear:(BOOL)animated?{
? ? ? ? ? [superview DidDisappear:animated];
? ? ? ? ? ?[self startSideBack];
}
/**
*?關(guān)閉ios右滑返回
*/
-(void)cancelSideBack{
? ? ? ? self.isCanUseSideBack=NO;
? ? ? ? if([self.navigationControllerrespondsToSelector:@selector(interactivePopGestureRecognizer)])?{
? ? ? ?self.navigationController.interactivePopGestureRecognizer.delegate=self;
}
}
/*
開啟ios右滑返回
*/
-?(void)startSideBack?{
? ? ? self.isCanUseSideBack=YES;
? ? ? if([self.navigationControllerrespondsToSelector:@selector(interactivePopGestureRecognizer)])?{
? ? ? ? ? self.navigationController.interactivePopGestureRecognizer.delegate=nil;?
? ? ? }
}
-?(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer*)gestureRecognizer?{
? ? ? return self.isCanSideBack;
}