8

This gesture recognizer code below, which normally would scale a view from the center, does not when auto-layout is enabled in iOS6. The view seems to scale from it's origin when auto layout is enabled. Other affine transformations (particularly scale and rotate) are also not working as I expected.

Anyone have this issue, or can enlighten me to the right way to handle this?

- (IBAction)handlePinch:(UIPinchGestureRecognizer *)recognizer {    
    recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale, recognizer.scale);
    recognizer.scale = 1;  
}
OWolf
  • 5,012
  • 15
  • 58
  • 93
  • Did you ever figure this out? I am really stuck on this issue. Please comment. – Dummy Code Jun 18 '13 at 23:52
  • @HenryHarris not sure because I stopped trying to use auto-layout, but I believe that if you create the view in question via code, and don't add constraints, that the gesture recognizer may perform as expected. – OWolf Jun 20 '13 at 02:07
  • thanks. I am trying to use storyboards and cannot turn auto-layout off for one part of my storyboard without getting this error, `Unable to simultaneously satisfy constraints` – Dummy Code Jun 20 '13 at 16:32
  • @HenryHarris strange... I thought that was an autoLayout error, ie you would get it if AL was ON. In any case you should be able to resolve that, but I never use AL myself as of now. I always manually disable it when I start a project. – OWolf Jun 21 '13 at 02:10
  • @Mrwolfy : hey. any solution to this issue????? – coder1010 Jul 18 '13 at 08:21
  • @coder1010 yeah, disable auto-layout. I think when I wrote this I was trying to integrate auto layout into my devs, at this point I have abandoned it as it just seems to be too complex. I may revisit it soon. – OWolf Jul 19 '13 at 03:13

1 Answers1

3

With Autolayout you should edit your constraints because transforms and constraints can be conflicting... I had the same problem and this session at WWDC helped me a lot. Take a look at the Video beginning at 30:35

sensslen
  • 780
  • 8
  • 17