Transparent ViewController to See Parent Below?

后端 未结 9 855
自闭症患者
自闭症患者 2021-02-01 18:59

I would like to modally add a view controller with a transparent background, so the parent view controller beneath can be seen. (This is in an app for iPhone, not for iPad.)

9条回答
  •  悲&欢浪女
    2021-02-01 19:50

    Swift 3 -

    Try vc.modalPresentationStyle = .overFullScreen

    let vc = self.storyboard!.instantiateViewControllerWithIdentifier("ExampleViewController") as! ExampleViewController
    vc.view.backgroundColor = UIColor.clearColor()
    vc.modalPresentationStyle = .overFullScreen
    self.presentViewController(vc, animated: true, completion: nil)
    

提交回复
热议问题