snipt

Ctrl+h for KB shortcuts

Objective-C

Rotate object

1
2
3
4
5
6
#define RADIANS( degrees ) ( ( degrees * M_PI ) / 180.0 )

CGAffineTransform rotateTransform = CGAffineTransformRotate( CGAffineTransformIdentity,
         RADIANS( 45.0 ) );

object.transform = rotateTransform;
https://snipt.net/embed/a179c073e48f3026812ce4842099a593/
/raw/a179c073e48f3026812ce4842099a593/
a179c073e48f3026812ce4842099a593
objective-c
Objective-C
6
2019-06-17T07:06:04
True
False
False
Feb 18, 2014 at 10:52 AM
/api/public/snipt/114780/
rotate-object
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">#define RADIANS( degrees ) ( ( degrees * M_PI ) / 180.0 )</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="bp">CGAffineTransform</span> <span class="n">rotateTransform</span> <span class="o">=</span> <span class="n">CGAffineTransformRotate</span><span class="p">(</span> <span class="n">CGAffineTransformIdentity</span><span class="p">,</span> </span><span id="L-4"><a name="L-4"></a> <span class="n">RADIANS</span><span class="p">(</span> <span class="mf">45.0</span> <span class="p">)</span> <span class="p">);</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="n">object</span><span class="p">.</span><span class="n">transform</span> <span class="o">=</span> <span class="n">rotateTransform</span><span class="p">;</span> </span></pre></div> </td></tr></table>
rotate, rotation