Swift 2.0 Popover视图无法在iPhone 6s plus上获得正确的位置,但它在iPhone 6s上运行良好

时间:2016-04-01 06:16:37

标签: ios swift popup

我有一个弹出类来处理弹出窗口问题,但我无法弄清楚为什么iPhone 6s plus无法设置固定高度,并且相同的代码在iPhone 6s上正常工作。

如果有任何想法,请提供帮助和建议。谢谢你。

iPhone 6s的输出加: The output on iPhone 6s plus

iPhone 6s上的输出(预期输出): The output on iPhone 6s (Expected output)

弹出功能代码:

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)
}

弹出功能调用:

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)
        }

0 个答案:

没有答案