我想在不同的位置呈現我的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