Search code examples
iphonecalayerquartz-graphics

CAGradientLayer Opacity property


I have a CAGradientLayer that I want to hide sometimes. The .hidden is a read-only property. The CAGRadientLayer is added as a sublayer to my view. I put in NSLog statements to see if my conditions are being hit and they are the way I want. However, sometimes the .opacity = 0.0 does hide the layer, sometimes it doesn't. Has anyone else had consistency problems with this? Is there a better way to hide the layer? Thanks.


Solution

  • Why do you say that the hidden property is readonly? It's writable:

    /* When true the layer and its sublayers are not displayed. Defaults to
     * false. Animatable. */
    
    @property(getter=isHidden) BOOL hidden;