簡體   English   中英

iOS 7禁用向后滑動

[英]iOS 7 disable the swipe back

在iOS應用程序中,有一個默認手勢,從左邊緣向右滑動,app navigationController將彈出視圖控制器。

但是有沒有辦法為特定視圖禁用它?

您可以通過公共API禁用它,請參閱UINavigationController類參考

  //iOS7 Customization, swipe to pop gesture
  if ([navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
      navigationController.interactivePopGestureRecognizer.enabled = NO;
  }

此外,您可以在需要時切換回以前的狀態

if(navigationController) {
  if ([navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
    navigationController.interactivePopGestureRecognizer.enabled = NO;
  }
}

它可能但可能是你拒絕應用的原因

-(void) viewWillAppear:(BOOL)animated 
{
    [super viewWillAppear:animated];
    self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM