title: Applying scaling and rotation on a view using CGAffineTransform
body: <p>So I need to apply some scaling and some rotation to a view (I do this using gestures), so for each gesture I update the current scalling and rotation values with something like:</p>
  
  <pre><code>self.scaleWidth *= gesture.scale; //When I detect an horizontal pinch
  self.scaleHeight *= gesture.scale; //When I detect a vertical pinch
  self.rotationAngle += gesture.rotationAngle; //When I detect a rotation
  </code></pre>
  
  <p>Then I do the following to transform the view:</p>
  
  <pre><code>CGAffineTransform transform = CGAffineTransformScale(CGAffineTransformIdentity, self.scaleWidth, self.scaleHeight);
  self.theSubViewToTransform.transform = CGAffineTransformRotate(transform, self.rotationAngle);
  </code></pre>
  
  <p>When I only do scaling, it works fine. When I do scaling then rotate, it rotates fine. When after rotating I try to scale again, it doesn't work fine: the scale is applied as if done after the rotation, deforming my image structure.</p>
  
  <p>I thought I did what needed to be done to avoid this: starting each time from an identity transform, scaling first then rotating, but obviously I was wrong...</p>
  
  <p>Does any one know what's wrong with my implementation ?</p>
  
  <p>Thanks</p>