您的位置:首页 > 移动开发 > IOS开发

IOS7、8模态半透明弹出框

2015-08-18 17:22 381 查看
[java] view
plaincopy





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

}

[java] view
plaincopy





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

版权声明:本文为博主原创文章,未经博主允许不得转载。 http://blog.csdn.net/liuhongwei123888/article/details/42001277/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: