当我们选择语言时,我想在UIPopoverPresentationController中显示一个UIPopoverPresentationController,就像iOS设置应用程序。它展示了一个viewController在设备屏幕的中心!

但是,我的结果不是那样的!

这是我的密码:
func rightButtonPressed(rightBarButton: UIBarButtonItem) {
let detailVC = self.storyboard?.instantiateViewControllerWithIdentifier("ExampleViewController") as! ExampleViewController
detailVC.modalPresentationStyle = .Popover
let popOverVC = detailVC.popoverPresentationController
popOverVC?.permittedArrowDirections = .Any
popOverVC?.barButtonItem = rightBarButton
popOverVC?.sourceView = self.view
popOverVC?.delegate = self
self.presentViewController(detailVC, animated: true, completion: nil)
}代表:
extension DetailViewController: UIPopoverPresentationControllerDelegate {
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
debugPrint(controller.description)
return .Popover
}
func presentationController(controller: UIPresentationController, viewControllerForAdaptivePresentationStyle style: UIModalPresentationStyle) -> UIViewController? {
let navController = UINavigationController.init(rootViewController: controller.presentedViewController)
return navController
}
}发布于 2016-04-03 16:57:36
尝试将演示文稿样式设置为工作表:
detailVC.modalPresentationStyle = UIModalPresentation.FormSheethttps://stackoverflow.com/questions/36388151
复制相似问题