草庐IT

ios - UISplitViewController presentsWithGesture 不工作

coder 2024-01-26 原文

我似乎无法让 presentsWithGesture 工作。我需要能够根据显示的详细 View Controller 打开和关闭它。

- (IBAction)disableGestures:(id)sender
{
    AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
    appDelegate.splitViewController.presentsWithGesture = NO;

    NSLog(@"Disable Gestures!");
}

我整理了一个简单的项目(使用默认的 UISplitViewController 模板): http://www.filedropper.com/splitviewtest

这不是 presentsWithGesture 的预期用途吗?

最佳答案

presentsWithGesture 设置为 NO(或 false)后,您还应该在主视图 Controller 和详细 View Controller 中的 UINavigationController 实例中禁用 interactivePopGestureRecognizer:

override func viewWillAppear() {
    super.viewWillAppear()

    self.navigationController?.interactivePopGestureRecognizer?.enabled = false
}

这对我有用。

关于ios - UISplitViewController presentsWithGesture 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13715250/

有关ios - UISplitViewController presentsWithGesture 不工作的更多相关文章

随机推荐