IOS7、8模态半透明弹出框

时间:2014-12-18作者:klpeng分类:数据库浏览:17990评论:0

           //源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];


打赏
文章版权声明:除非注明,否则均为彭超的博客原创文章,转载或复制请以超链接形式并注明出处。
相关推荐

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

猜你喜欢