且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

适用于iOS 5.1及更低版本的UISplitViewController中的UIPopoverController手势处理

更新时间:2023-12-04 13:36:16

对于任何类型的向后兼容性,首先检查是否存在新属性的setter方法...

For any type of backward compatibility, check for the presence of the setter method for the new property first...

if ([mySplitViewController respondsToSelector:@selector(setPresentsWithGesture:)]) {
    [mySplitViewController setPresentsWithGesture:NO];
}

请注意,显然你需要在添加UISplitViewController.view之前执行此操作你的窗口。我猜测在那时检查属性并添加手势识别器。如果在添加视图后更改属性,则没有明显的效果。

Note that apparently you need to do this before you add the UISplitViewController.view to your window. I'm guessing that at that point the property is examined and the gesture recognizer is added or not. If you change the property after adding the view, it has no discernible effect.