iOS present出有透明度的ViewController

presentingViewController:

UIViewController *vc = [UIViewController new];
[self presentViewController:vc animated:YES completion:nil];

presentedViewController:

- (instancetype)init {
    self = [super init];
    if (self) {
        self.modalPresentationStyle = UIModalPresentationCustom;//采用自定义呈现方式
        self.modalTransitionStyle = UIModalTransitionStyleCoverVertical;//采用从低往上动态覆盖的方式转场
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];//设置透明度
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。