我在我的应用程序中使用 MGSplitViewController 库。直到 iOS7 都可以正常工作,但是对于 iOS8 来说,它不能按预期工作,原因是iOS8中 UIPopoverController 的行为发生了变化。附件是在iOS8上运行MGSplitView代码的屏幕截图:
显示错误的行为。它应该类似于以下屏幕截图:
我读过某处关于MGSplitViewController库不会针对iOS8修复程序进行更新的消息。有人知道我们是否还有另一个适用于iOS8且与MGSplitViewController类似功能的库。
最佳答案
我遇到了同样的问题,并找到了解决方案。转到MGSplitViewController.m
并在-splitViewSizeForOrientation:
中找到以下几行(第261行左右):
width = height;
height = fullScreenRect.size.width;
确保它不能在iOS 8上运行,因为iOS 8可以正确处理尺寸。也许是这样。
if (SYSTEM_VERSION_LESS_THAN(@"8.0") && UIInterfaceOrientationIsLandscape(theOrientation)) {
width = height;
height = fullScreenRect.size.width;
}
然后在
-reconfigureForMasterInPopover:
中找到以下行(在614行附近):[_hiddenPopoverController presentPopoverFromRect:CGRectMake(-2000, -2000, 1, 1) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];
并确保它不能在iOS 8上运行。再次,也许是这样。
if (SYSTEM_VERSION_LESS_THAN(@"8.0")) {
[_hiddenPopoverController presentPopoverFromRect:CGRectMake(-2000, -2000, 1, 1) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];
}
关于uisplitviewcontroller - iOS8 MGSplitViewController替代,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25246365/