#坑1# iOS8以后presendViewController透明效果无效
来源:互联网 发布:sql注入单引号原理 编辑:程序博客网 时间:2024/06/05 11:59
本文出自
http://mokai.github.io/2015/10/ios-bug-viewcontroller_translucent/
iOS弹出的视图背景默认是黑色,如果想去掉,以往我们使用 self.modalPresentationStyle = .CurrentContext
就可以实现效果,如以下半透明的代码
let vc = UIViewController() vc.view.backgroundColor = UIColor(red:0.000 , green:0.000 , blue:0.000, alpha:0.5) self.modalPresentationStyle = .CurrentContext self.presentViewController(vc, animated: true, completion: nil)
但是你会发现这段代码在iOS8、iOS9上面运行依旧一片黑,因此iOS8以后得这么干
let vc = UIViewController()vc.view.backgroundColor = UIColor(red:0.000 , green:0.000 , blue:0.000, alpha:0.5)if let version = Float(UIDevice.currentDevice().systemVersion) where version >= 8{ vc.modalPresentationStyle = .OverCurrentContext //注意此处是弹出VC对象,不是self}else{ self.modalPresentationStyle = .CurrentContext}self.presentViewController(vc, animated: true, completion: nil)
iOS8后增加了OverCurrentContext
取代CurrentContext
,并且设置的对象是弹出的VC
0 0
- #坑1# iOS8以后presendViewController透明效果无效
- 自绘控件里实现控件无效区域透明效果
- ios8 定位无效
- NSAttributedString的NSUnderlineStyleSingle在iOS8.1上无效的解决方法
- ios8以后Label自适应大小
- ios8以后的搜索栏
- 透明效果
- 透明效果
- iOS8 毛玻璃效果
- iOS8 毛玻璃效果
- iOS8 毛玻璃效果实现
- iOS8+毛玻璃效果
- iOS8 添加毛玻璃效果
- iOS8以后推送通知需要访问权限
- ios8以后要自己开启定位权限
- ios8以后的一种即时渲染
- iOS8以后的屏幕宽高变化
- iOS8.3以后无法访问沙盒
- ps实用技巧上
- 使用VS搭建三层结构
- bat启动java程序,集成jre
- UI: 带有Heard的ListView控件
- linux查看线程cpu占用情况
- #坑1# iOS8以后presendViewController透明效果无效
- 根据sessionId获取Session对象
- 分别用递归和非递归方式实现二叉树的先序、中序和后序遍历
- 杭电5273
- 最实用的基础动画push pop新界面的时候
- 俄罗斯方块 编程代码
- 雷观(二十三)-IT互联网技术,不拼创新拼努力,特别低公平
- 输入三个数,请把这三个数由小到大的排列
- 最直白非对称加解密