我的目标是以编程方式将UIViewController呈现为弹出窗口。
如您所见,过渡样式设置为Cross Dissolve,演示文稿设置为Over current context。因此,从技术上讲,如果我单击该按钮,过渡将起作用,我的目标是以编程方式进行操作。
func clickButton() {
//What should I do here?
}
Run Code Online (Sandbox Code Playgroud)
如何以编程方式显示弹出窗口clickButton?
如果您以模态呈现视图控制器。你可以这样
func clickButton() {
if let vc = self.storyboard?.instantiateViewController(withIdentifier:"YOUR_VIEW_CONTROLLER_ID") {
vc.modalTransitionStyle = .crossDissolve;
vc.modalPresentationStyle = .overCurrentContext
self.present(vc, animated: true, completion: nil)
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4628 次 |
| 最近记录: |