自定义提示框modal跳转带透明背景

2020-02-05  本文已影响0人  架构师的一小步
//其它页面
 SynSuccess *alertVc = [[SynSuccess alloc] initWithNibName:@"SynSuccess" bundle:nil];
    alertVc.delegate=self;
    RootNavigationController *nav = [[RootNavigationController alloc] initWithRootViewController:alertVc];
    nav.navigationBarHidden = YES;
    nav.modalPresentationStyle = UIModalPresentationOverCurrentContext;
    nav.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
//因为是底部有tabbar,要想全部遮住需要用self.tabBarController去跳转
    [self.tabBarController presentViewController:nav animated:YES completion:nil];

//SynSuccess.m文件
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    }
    return self;
}

参考文章:UIModalPresentationStyle和UIModalTransitionStyle效果显示

上一篇 下一篇

猜你喜欢

热点阅读