popover不显示在iPhone上 [英] popover doesn't display on iphone
本文介绍了popover不显示在iPhone上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遵循了这个 iPhone上的UIPopoverPresentationController不会产生弹出窗口,但不会不会在iPhone上产生弹出式窗口. 这是viewcontroller的代码
I followed this UIPopoverPresentationController on iPhone doesn't produce popover but doesn't produce popover on iphone. Here is the code of viewcontroller
class ViewController:UIViewController,UIPopoverPresentationControllerDelegate{
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "second"{
let secondVC = segue.destination
let controller : UIPopoverPresentationController = secondVC.popoverPresentationController!
controller.delegate = self
}
}
/* Popover delegate method */
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return UIModalPresentationStyle.none
}
}
我无法在iPhone中使用present作为弹出窗口显示新的viewcontroller. (ios 10/xcode8)
I am not able to show new viewcontroller using present as popover in iphone. (ios 10/xcode8)
在单击按钮后,secondViewController应该在该按钮上弹出.
推荐答案
使用此委托方法后,它将在iPhone上产生弹出式窗口.
After using this delegate method it is producing popover on iphone.
func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
return UIModalPresentationStyle.none
}
这篇关于popover不显示在iPhone上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文