Я хочу всегда отображать контроллер представления во всплывающем окне на всех устройствах и во всех ориентациях. Я попытался добиться этого, приняв UIPopoverPresentationControllerDelegate
и установив sourceView
и sourceRect
. Переход в раскадровке настроен как переход Present As Popover. Это очень хорошо работает для всех устройств и ориентаций, кроме iPhone 6 Plus в альбомной ориентации. В этом случае контроллер представления скользит вверх от нижней части экрана на листе формы. Как я могу предотвратить это, чтобы он всегда отображался во всплывающем окне?
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let popoverPresentationController = segue.destinationViewController.popoverPresentationController
popoverPresentationController?.delegate = self
popoverPresentationController?.sourceView = self.titleLabel!.superview
popoverPresentationController?.sourceRect = self.titleLabel!.frame
}
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return UIModalPresentationStyle.None
}