IOS7、8模态半透明弹出框

来源:互联网 发布:java svn api 编辑:程序博客网 时间:2024/06/06 07:29

           //源Controller中跳转方法实现            MKDialogController *controller = [[MKDialogController alloc] init];            controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;            if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {                controller.providesPresentationContextTransitionStyle = YES;                controller.definesPresentationContext = YES;                controller.modalPresentationStyle = UIModalPresentationOverCurrentContext;                [self presentViewController:controller animated:YES completion:nil];            } else {                self.view.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;                [self presentViewController:controller animated:NO completion:nil];                self.view.window.rootViewController.modalPresentationStyle = UIModalPresentationFullScreen;            }

    self.view.backgroundColor = [UIColor clearColor];    UIView *alphaView = [[UIView alloc] initWithFrame:self.view.frame];    UIView *baseView = [[UIView alloc] initWithFrame:self.view.frame];    alphaView.backgroundColor = [UIColor clearColor];    baseView.backgroundColor = [UIColor blackColor];    baseView.alpha = 0.7;    [self.view addSubview:baseView];    [self.view addSubview:alphaView];


3 0
原创粉丝点击