[英]iOS 7 disable the swipe back
In iOS apps, there is a default gesture that swipe from the left edge to right the app navigationController
will pop view controller. 在iOS应用程序中,有一个默认手势,从左边缘向右滑动,app
navigationController
将弹出视图控制器。
But is there a way to disable it for specific view? 但是有没有办法为特定视图禁用它?
You can disable it through the public API, See UINavigationController Class Reference 您可以通过公共API禁用它,请参阅UINavigationController类参考
//iOS7 Customization, swipe to pop gesture
if ([navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
navigationController.interactivePopGestureRecognizer.enabled = NO;
}
Also, you can switch back to previous state when needed 此外,您可以在需要时切换回以前的状态
if(navigationController) {
if ([navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
navigationController.interactivePopGestureRecognizer.enabled = NO;
}
}
its possible but may be a cause for you app rejection 它可能但可能是你拒绝应用的原因
-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.