我想在不同的位置呈现我的popover。默认情况下,它从用户选择按钮的地方开始。我使用的UIViewController而不是UIPopoverController因为UIPopoverController在iOS9弃用popover改变位置的起点(原点位置)iOS9
class CustomPop: UIViewController, UIPopoverPresentationControllerDelegate {
init() {
super.init(nibName: nil, bundle: nil)
self.modalPresentationStyle = UIModalPresentationStyle.Popover;
self.popoverPresentationController?.delegate = self;
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle{
return .None
}
}
//for example something like this but I need it for a popover:
custom = CustomPop()
custom.frame.origin.y = self.view.height - 100
// is there a way to use CGRectMake for the popover to accomplish this?
你想要的酥料饼是在精确的位置,或者也许你想要的箭头要放在弹出窗口的左边大小还是中间或左边或类似的东西? – Korpel