backgroundColor
@property(nullable, nonatomic,copy) UIColor *backgroundColor UI_APPEARANCE_SELECTOR; // default is nil. Can be useful with the appearance proxy on custom UIView subclasses.
解释:
- 背景色,作用区域为frame(bounds),默认nil,nil时透明背景色
hidden
@property(nonatomic,getter=isHidden) BOOL hidden; // default is NO. doesn't check superviews
解释:
- hidden = YES,view不可见,hidden = NO,view可见,默认为NO
- hidden = YES,view所有descendant不可见,但不影响descendant hidden状态
- hidden = YES,不影响superview可见性和hidden状态
- hidden = YES,view依然在view hierarchy中,依然参与autoresizing
- hidden = YES,view不接收input event,若view是windows's current first responder,则view's next valid key view to become the new first responder
alpha
@property(nonatomic) CGFloat alpha; // animatable. default is 1.0
解释:
- 仅影响view,不影响subviews,作用于view的cached bitmap
- 范围0~1,0完全透明,1完全不透明
opaque
@property(nonatomic,getter=isOpaque) BOOL opaque; // default is YES. opaque views must fill their entire bounds or the results are undefined. the active CGContext in drawRect: will not have been cleared and may have non-zeroed pixels
解释:
- 不透明标志,opaque = YES,表示完全不透明,默认为YES
- opaque = YES,绘画系统会优化绘制操作以提高性能,比如被不透明view遮挡部分无需绘制,opaque = NO,绘画系统会正常组合view和其他内容
- opaque = YES,alpha应为1,若opaque = YES,而view bounds未完全填充或含完全或部分透明内容,结果不可预测,若view完全或部分透明,opaque应设为NO
- 系统提供的类,如UIButton,UILabel,UITableViewCell等,opaque无效果,自定义UIView子类使用drawRect绘制内容需正确设置opaque