iOS present出有透明度的ViewController

2020-12-09  本文已影响0人  可bing

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];//设置透明度
}
上一篇下一篇

猜你喜欢

热点阅读