如何正确设置UIView的alpha?

我有UIView有很多子视图(UILabel,UITextView等)。

如果一个集合的alpha 0.6到主视图的所有子视图都采用这个alpha。

如何分别设置主视图的alpha?

  [view setBackgroundColor:[[UIColor clearColor] colorWithAlphaComponent:0.5]]; //try this.. dont try to set alpha of UIView and also your subviews will not affect 
 myView.layer.shouldRasterize = YES 

这将使它使用group opacity ,一切都应该像你期望的那样复合。