iOS8下 原来presentViewController的画面(不是全画面,画面以外地方透明)的透明部分 变成黑色不透明了
换句话说,self.modalPresentationStyle = UIModalPresentationCurrentContext;不好用了
今天试了无数个方法终于找到了解决方法。
ios8多了一个样式UIModalPresentationOverCurrentContext,跟原来的很相近哦。而且定义的对象也变成了弹出的视图。
所以用的话做版本判断:
if ([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0) {
nextVC.modalPresentationStyle=UIModalPresentationOverCurrentContext;
}else{
self.modalPresentationStyle=UIModalPresentationCurrentContext;
}
[self presentViewController: nextVC animated:YES completion:nil];
本文解决了 iOS8 下使用 UIModalPresentationCurrentContext 导致弹出视图背景变黑的问题。通过版本判断使用不同的 modalPresentationStyle,确保了在 iOS8 及以上版本中正确实现半透明背景效果。
445

被折叠的 条评论
为什么被折叠?



