Transparent ViewController to See Parent Below?

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

    UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
        ChooseController *sec=[story instantiateViewControllerWithIdentifier:@"Controller"];
        sec.modalPresentationStyle = UIModalPresentationOverCurrentContext;
        sec.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
        [self presentViewController:sec animated:YES completion:^{
    
        }];
    

    Note:Present controller superview alpha value must be below 1 like 0.5 alpha like that.

提交回复
热议问题