Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I’m guessing the person you spoke with was referring to <a href="https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html" rel="nofollow noreferrer">CALayer</a>. In iOS, every view has a CALayer backing it. Instead of implementing <code>-drawRect:</code> in your view, do this:</p> <ol> <li><a href="https://stackoverflow.com/a/10343287/255489">link with QuartzCore</a></li> <li><code>#import &lt;QuartzCore/QuartzCore.h&gt;</code> anywhere you want to use this.</li> <li>Use to your view’s <a href="http://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/uiview/uiview.html#//apple_ref/occ/instp/UIView/layer" rel="nofollow noreferrer"><code>layer</code></a> property.</li> </ol> <p>Layers behave a lot like views, in that you can have sublayers and superlayers, and layers have properties for things like background color, and they can be animated. A couple of subclasses that will probably be useful for your purposes are <a href="https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CAGradientLayer_class/Reference/Reference.html" rel="nofollow noreferrer"><code>CAGradientLayer</code></a> and <a href="https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CAShapeLayer_class/Reference/Reference.html" rel="nofollow noreferrer"><code>CAShapeLayer</code></a>. For more on how to use layers, refer to the <a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html" rel="nofollow noreferrer">Core Animation Programming Guide</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload