iOS-UIView的alpha、hidden和opaque -区别
2016-08-24 15:26
507 查看
iOS-UIView的alpha、hidden和opaque -区别
首先放结论
如果你的View没有任何透明(也就是alpha==1),尽管把opaque==YES.这样会加快GPU的处理速度
有疑惑的同学继续看
一、alphaalpha:
1 不透明 0 透明
透明之后:
当前的UIView和subview都会被隐藏,而不管subview的alpha值为多少。
当前UIView会从响应者链中移除,而响应者链中的下一个会成为第一响应者
二、hidden
hidden
YES 隐藏 NO 不隐藏
隐藏之后
当前的UIView和subview都会被隐藏,而不管subview的hidden值为多少。
当前UIView会从响应者链中移除,而响应者链中的下一个会成为第一响应者
三、opaque
opaque
YES 不透明 NO 透明
我个人关于
opaque==NO解释:
该View的父View的layer层将影响自身.
什么意思呢?绘画过同学know,RED+GREEN=YELLOW
对吧?:)
打个比方父View的Background为RED,自身的Background设置为GREEN
最后显示的其实是YELLOW(RED+GREEN),也就是黄色
另外需要注意的是opaque和alpha只能有一个!=1
苹果官方说明
An opaque view is expected to fill its bounds with entirely opaque content—that is, the content should have an alpha value of 1.0. If the view is opaque and either does not fill its bounds or contains wholly or partially transparent content,the results are unpredictable. You should always set the value of this property to NO if the view is fully or partially transparent.
相关文章推荐
- IOS的UIView的透明hidden,alpha,opaque的区别
- iOS 中 UIView属性hidden, opaque, alpha的区别
- iOS开发-Alpha,Hidden与Opaque区别
- UIView的alpha、hidden和opaque属性之间的关系和区别
- UIView的alpha、hidden和opaque属性之间的关系和区别
- UIView的alpha、hidden和opaque属性之间的关系和区别
- ios开发之View属性hidden, opaque, alpha的区别
- UIView的alpha、hidden和opaque属性之间的关系和区别
- UIView的alpha、hidden和opaque属性之间的关系和区别
- 转载: ios开发之View属性hidden, opaque, alpha的区别
- ios开发之View属性hidden, opaque, alpha, opacity的区别
- UIView的alpha、hidden和opaque属性之间的关系和区别[转]
- UIView的alpha、hidden和opaque属性之间的关系和区别
- UIView的alpha、hidden和opaque属性之间的关系和区别
- UIView的alpha、hidden和opaque属性之间的关系和区别
- UIView的alpha、hidden和opaque属性之间的关系和区别
- UIView的alpha、hidden和opaque属性之间的关系和区别
- ios开发之View属性hidden, opaque, alpha的区别
- UIView的alpha、hidden和opaque属性之间的关系和区别(转载)
- iOS开发-Alpha,Hidden与Opaque区别