基本步骤
添加视图:主视图与弹出视图
关联视图
配置弹出视图
编码实现:弹出菜单样式及控制器委托
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "popoverSegue" {
let popoverViewController = segue.destinationViewController as UIViewController
popoverViewController.modalPresentationStyle = UIModalPresentationStyle.Popover
popoverViewController.popoverPresentationController!.delegate = self
}
}
编码实现:利用弹出视图控制器委托方法,定制弹出菜单的样式
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return UIModalPresentationStyle.None
}
运行
参考