Ios8 致电adaptivePresentationStyleForPresentationController,即使是iPad sim卡

Ios8 致电adaptivePresentationStyleForPresentationController,即使是iPad sim卡,ios8,adaptive-ui,Ios8,Adaptive Ui,我有一个viewcontroller实现UIPopoverPresentationControllerDelegate方法: adaptivePresentationStyleForPresentationController(controller: UIPresentationController!, traitCollection: UITraitCollection!) -> UIModalPresentationStyle 据我所知,这只适用于小巧的iPhone 6,而不适用于

我有一个viewcontroller实现UIPopoverPresentationControllerDelegate方法:

adaptivePresentationStyleForPresentationController(controller: UIPresentationController!, traitCollection: UITraitCollection!) -> UIModalPresentationStyle 
据我所知,这只适用于小巧的iPhone 6,而不适用于iPad。但在一个项目中,它甚至被称为iPad,因此,我没有得到一个popover,而是全屏模态的东西

我看不出是什么导致了这一切。我调查了另一个设置大致相同的项目,并确认在ipadsim(仅iphone)中不会调用此方法


还有其他人经历过吗?

我发现了问题所在。我在代码完成过程中选择了错误的func,我想使用的正确委托方法是:

adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle
不是


根据您的iOS级别,您应该使用
adaptivePresentationStyleForPresentationController:traitCollection:

我正在使用这个方法(返回
.None
),它在我迄今为止测试过的所有设备上都有效

在苹果公司的
adaptivePresentationStyleForPresentationController:
文档中,它说:

在iOS 8.3及更高版本中,使用adaptivePresentationStyleForPresentationController:traitCollection:方法来处理所有特征更改,而不是使用此方法。如果未实现该方法,则可以在转换到水平紧凑的环境时使用此方法更改表示样式

编辑 对于我的目标iOS 8,我实际上使用了这两种方法。8.3之前版本不会使用带有
traitCollection:

adaptivePresentationStyleForPresentationController(controller: UIPresentationController!, traitCollection: UITraitCollection!) -> UIModalPresentationStyle