such as the code:
view.opaque = YES;
and
view.backgroundColor = [UIColor clearColor];
any one who can explain something about this?
EDIT:
as the document shows:
Declare Views as Opaque Whenever Possible
UIKit uses the opaque property of each view to determine whether the view can optimize compositing operations. Setting the value of this property to YES for a custom view tells UIKit that it does not need to render any content behind your view. Less rendering can lead to increased performance for your drawing code and is generally encouraged. Of course, if you set the opaque property to YES, your view must fills its bounds rectangle completely with fully opaque content.
opaque property is used for determining whether the view can optimize compositing operations.
so the question is:
if i set view.opaque = YES
and view.backgroundColor = [UIColor clearColor]
,the former increased performance,how about the latter?
No, it shouldn't be. It should act clear. The color clear is completely opaque, if that even makes sense. It won't show up black or white or anything else if you change its alpha. It will be clear.
The opaque flag is used as an optimization for rendering. If you set it to YES when the view shouldn't be opaque you can get unexpected rendering if you actually want things to be visible through the view.
My understanding is that the opaque flag is sometimes checked to see if alpha value should even be checked.