Transparent ViewController to See Parent Below?

后端 未结 9 852
自闭症患者
自闭症患者 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:47

    @Josh Kahane set the view controller that will present the transparent view controller with this code at the -ViewDidLoad and be sure to set the alpha channel of the UIViewController View to be lower then 1.

    Code:

    self.modalPresentationStyle = UIModalPresentationCurrentContext;
    

提交回复
热议问题