Search code examples
iosrotationuiimagescaletransformation

Making two transformation changes (scale, rotation) in iOS


I'm trying to do the following transformation changes but only one seems to work: -

self.image1.transform = CGAffineTransformMakeRotation(-0.1);
self.image1.transform = CGAffineTransformMakeScale(1.1, 1.1);

Only the first transformation works, what do I need to do make both changes work?


Solution

  • When using CGAffineTransformMake... you are creating a new transformation. So in your code you overwrite the Rotation with the Scale transformation.

    CGAffineTransform transform = CGAffineTransformMakeRotation(-0.1);
    transform = CGAffineTransformScale(transform, 1.1, 1.1);
    self.image1.transform = transform;