我想像SelectFooViewController
一样提出UIAlertController
。
上下文代码将是......
let vc = SelectFooViewController()
self.present(vc, animated: true, completion: nil)
它将弹出一个模态视图,即当前视图的顶部。
答案 0 :(得分:0)
您必须设置providesPresentationContextTransitionStyle
,definesPresentationContext
和modalPresentationStyle
let vc = SelectFooViewController()
vc.providesPresentationContextTransitionStyle = true
vc.definesPresentationContext = true
vc.modalPresentationStyle = .overCurrentContext
self.present(vc, animated: true, completion: nil)
答案 1 :(得分:0)
首先你在storyBoard中将视图alpha设置为10以下,你使用哪个控制器并使用以下代码......
let viewController : SelectFooViewController = self.storyboard!.instantiateViewController(withIdentifier: "Your controller Identifier") as! SelectFooViewController
viewController.providesPresentationContextTransitionStyle = true;
viewController.definesPresentationContext = true;
viewController.modalTransitionStyle = .crossDissolve
viewController.modalPresentationStyle = .overCurrentContext
self.present(viewController, animated: true, completion: nil)