Я пытаюсь показать popover в iPhone. Я следую рекомендациям, которые я нашел здесь, и используя делегат «adaptivePresentationStyle», но эта функция никогда не вызывается, а ViewController всегда будет отображаться в полноэкранном режиме. У меня есть «UIPopoverPresentationControllerDelegate» и функции ржали:Swift 3 - adaptivePresentationStyle никогда не называется
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let identifier = segue.destination.restorationIdentifier ?? ""
if identifier == "NavigationSetup" {
if let destinationNav = segue.destination as? UINavigationController {
let destination = destinationNav.topViewController as! SetupTableViewController
destination.popoverPresentationController?.delegate = self
destination.popoverPresentationController?.backgroundColor = UIColor.blue
if self.myApp.isIpad{
destination.preferredContentSize = CGSize(width: 600, height: 620)
}else{
destination.preferredContentSize = CGSize(width: 0.8 * self.view.frame.size.width, height: 0.8 * self.view.frame.size.height)
}
self.cellAnimations.fade(image: self.imageBlur, initOpacity: 0, endOpacity: 1, time: 0.3, completion: nil)
destination.setupDismiss = {[weak self]() in
if let weakSelf = self{
weakSelf.cellAnimations.fade(image: weakSelf.imageBlur, initOpacity: 1, endOpacity: 0, time: 0.3, completion: nil)
}
}
}
}
}
func adaptivePresentationStyle(for controller:UIPresentationController) -> UIModalPresentationStyle {
print("adaptive was called")
return .none
}
Итак, что я здесь отсутствует?
Я думаю .. вам не хватает .. 'popController.modalPresentationStyle = UIModalPresentationStyle.popover' – TonyMkenu
проверить это .. http://stackoverflow.com/questions/39972979/popover-in-swift -3-on-iphone-ios/39975346 # 39975346 – TonyMkenu
Спасибо, человек, но я использовал «пункт назначения» и должен использовать «destinationNav». Теперь работает. – ClaytonAV