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

IOS8以上或以下 presentViewController 背景不透明解决办法

2016-12-16 11:14 645 查看
IOS8及以上,设置

nextVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;

IOS8以下,设置

self.modalPresentationStyle = UIModalPresentationCurrentContext;

其中 nextVC 是要显示的ViewController, self是当前ViewController。

全部代码如下:

nextVC.view.backgroundColor = [UIColor clearColor];

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
nextVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
} else {
self.modalPresentationStyle = UIModalPresentationCurrentContext;
}

[self presentViewController:nextVC animated:YES completion:nil];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ios