【发布时间】:2016-03-07 14:57:17
【问题描述】:
这是我用来呈现popover的:
func presentPopoverController(controller: UIViewController, fromView view: UIView) {
controller.modalPresentationStyle = UIModalPresentationStyle.Popover
controller.preferredContentSize = CGSizeMake(400, 400)
let popover = controller.popoverPresentationController
popover?.permittedArrowDirections = .Any
print(view.frame)
popover?.sourceView = view
popover?.sourceRect = view.frame //***
presentViewController(controller, animated: true, completion: nil)
}
这是它在屏幕上的样子:
这是控制台的输出:
(326.0, 15.0, 63.0, 10.0)
如果我删除带有***的行,那么它看起来像下面这样,并且仍然在错误的位置:
控制台输出同上。
【问题讨论】:
标签: ios swift uipopovercontroller