title: Howto CALayer's image scale independently of CALayer's bounds
body: <p>I can't find an answer for this one. </p>
  
  <p>I would like to know how to have the image size in a calayer's to be lower than calayer's bound's size. </p>
  
  <p>I've got several pawns in an iPad game, each is a CALayer and I have them resize simply with a contentsGravity=kCAGravityResizeAspect. Image is 128x128 inside of a CALayer of 30x30 so the image gets resized automatically to 30x30 and because of both being a box, aspect ratio maintains and works. </p>
  
  <p>Here I set CALayer's bounds proportional relative to superview's size, so the Pawns always present the same relative size to the view. This one is inside my sprite class subclass of calayer:</p>
  
  <pre><code>-(void) setSpriteScaleToDice {
      CGFloat newSize = [self superlayer].bounds.size.width * 0.066666667f; 
      self.bounds=CGRectMake(0.0f, 0.0f, newSize, newSize);
      self.contentsGravity = kCAGravityResizeAspect; 
  }
  </code></pre>
  
  <p>Note that in my case the CALayer bounds gets a maximum of 30x30 which is small for a touch. That's the problem I'm facing, due to this small size it's difficult to "touch" them, sometimes touch fails... </p>
  
  <p>One of the ideas that I'm thinking is to increase the "bounds" of the calayer, while keeping the image at its original size. The problem is that I've search a lot and tried several options with contentsGravity, contentsCenter, contentsScale, etc... without success.</p>
  
  <p>In particular, as per apple docs looks like the way to go is with contentsCenter (and not using contentsGravity), however I get deformation in the bitmap... </p>
  
  <p>Please, any idea is really welcome, and thanks in advance, </p>
  
  <p>Luis</p>