wiz*_*mea 5 xcode uiviewcontroller ios swift4
我该如何以模态呈现viewController。是ios中的新手,并且正在使用swift4我尝试了
let userVC = mainStoryboard.instantiateViewController(withIdentifier:
"menuC") as! MenuController
userVC.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
userVC.navigationController?.modalPresentationStyle =
UIModalPresentationStyle.overCurrentContext
present(userVC, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
像这样
if let presentedViewController = self.storyboard?.instantiateViewController(withIdentifier: "menuC") {
presentedViewController.providesPresentationContextTransitionStyle = true
presentedViewController.definesPresentationContext = true
presentedViewController.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext;
presentedViewController.view.backgroundColor = UIColor.init(white: 0.4, alpha: 0.8)
self.present(presentedViewController, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7205 次 |
| 最近记录: |