在UINavigationController的delegate中实现以下方法:
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
//开启滑动手势
if ([navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
navigationController.interactivePopGestureRecognizer.enabled = YES;
}
}
在pushviewcontroller之前加入以下代码:
//在切换界面的过程中禁止滑动手势,避免界面卡死
if ([_currentNav respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
_currentNav.interactivePopGestureRecognizer.enabled = NO;
}
[_currentNav pushViewController:viewController animated:YES];
即可在实现滑动返回的同时,避免界面卡死的问题。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持ASPKU。
注:相关教程知识阅读请移步到IOS开发频道。










