转载: ios开发之View属性hidden, opaque, alpha的区别

文章转载自 http://blog.csdn.net/caryaliu/article/details/7837916

1. @property(nonatomic) CGFloat alpha;

The value of this property is a floating-point number in the range 0.0 to 1.0, where 0.0 represents totally transparent and 1.0 represents totally opaque.This value affects only the current view and does not affect any of its embedded subviews.
Changes to this property can be animated.


2. @property(nonatomic, getter=isHidden) BOOL hidden;

A Boolean value that determines whether the receiver is hidden.

Setting the value of this property to YES hides the receiver and setting it to NO shows the receiver. The default value is NO.
A hidden view disappears from its window and does not receive input events. Itremains in its superview’s list of subviews, however, and participates in autoresizing as usual.Hiding a view with subviews has the effect of hiding those subviews and any view descendants they might have. This effect is implicit anddoes not alter the hidden state of the receiver’s descendants.
Hiding the view that is the window’s current first responder causes the view’s next valid key view to become the new first responder.
The value of this property reflects the state of the receiver only and does not account for the state of the receiver’s ancestors in the view hierarchy. Thus this property can be NO but the receiver may still be hidden if an ancestor is hidden.


3. @property(nonatomic, getter=isOpaque) BOOL opaque;

A Boolean value that determines whether the receiver is opaque.

This property provides a hint to the drawing system as to how it should treat the view.If set to YES, the drawing system treats the view as fully opaque, which allows the drawing system to optimize some drawing operations and improve performance. If set to NO, the drawing system composites the view normally with other content. The default value of this property is YES.
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.


These properties affect the opacity of the view. The alpha and hidden properties change the view’s opacity directly.
The opaque property tells the system how it should composite your view. Set this property to YES if your view’s content is fully opaque and therefore does not reveal any of the underlying view’s content. Setting this property to YES improves performance by eliminating unnecessary compositing operations.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值