2017-12-22 20 views
1

어떻게하면 viewController를 모달로 표시 할 수 있습니까? IOS의 새로운 초보자 오전 swift4 를 사용하고 나는이modaly 스위프트에서 ViewController를 표시하는 방법 4

let userVC = mainStoryboard.instantiateViewController(withIdentifier: 
    "menuC") as! MenuController 
    userVC.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext 
     userVC.navigationController?.modalPresentationStyle = 
    UIModalPresentationStyle.overCurrentContext 
    present(userVC, animated: true, completion: nil) 

답변

0

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) 
    } 
좋아하세요 시도