Reputation: 41
I have a popup class to handle the popup issue but i cannot figure out why iPhone 6s plus cannot set the fixed height and the same code works fine on iPhone 6s.
Please help and advise if any idea. Thanks you.
The output on iPhone 6s plus:
The output on iPhone 6s (Expected output):
Popup Function Code:
func showPopover(segue: UIStoryboardSegue?, sender: AnyObject?, controller:UIViewController, animated:Bool) {
let senderView = sender as! UIView
controller.modalPresentationStyle = UIModalPresentationStyle.Popover
controller.popoverPresentationController?.delegate = self
controller.popoverPresentationController?.sourceView = senderView
controller.popoverPresentationController?.sourceRect = senderView.bounds;
self.presentViewController(controller, animated: animated, completion: nil)
}
Popup Function Call:
if let controller = segue.destinationViewController as? TeamMenuPopupTableViewController {
controller.rosterHandler = self.homeRoster
controller.timeoutHandler = self.homeTimeout
controller.boxscoreHandler = self.homeBoxscore
controller.preferredContentSize = CGSize(width: 200, height: 132)
showPopover(segue, sender: sender, controller: controller, animated:false)
}
Upvotes: 3
Views: 236
Reputation: 41
I found the solution on internet and it should add this function to handle iPhone plus case.
func adaptivePresentationStyleForPresentationController(
controller: UIPresentationController,
traitCollection: UITraitCollection)
-> UIModalPresentationStyle {
return .None
}
For the detail, please check this link. Why isn't preferredContentSize used by iPhone 6 Plus Landscape?
Upvotes: 1