iPhone에서 팝업을 표시하려고합니다. 내가 여기에서 발견하고 대리자 "adaptivePresentationStyle"을 사용하는 제안을 따르고 있지만이 함수는 호출되지 않으며 ViewController는 항상 전체 화면 모드로 표시됩니다. 나는 "UIPopoverPresentationControllerDelegate"이 있고 기능이 울부 짖는 소리 :스위프트 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
감사합니다.하지만 "destination"을 사용하고 있었고 "destinationNav"를 사용해야합니다. 지금 일하고있어. – ClaytonAV