title: zooming in scrollview ios6
body: <p>I am trying to implement a simple ImageView in a scrollview to display an image. I want to particularly implement the pinch to zoom feature. I implemented the following code (which is taken from one of the Objective C sample codes on the apple websites). I tested the zooming thoroughly on ios 5 and there seems to be no problem. However when I ported my code to ios 6 and I test my zoom feature, after a while I get the following error message and my app crashes with skewed zoom results.</p>
  
  <p>Unable to simultaneously satisfy constraints.
      Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) </p>
  
  <p>NSAutoresizingMaskLayoutConstraint:0x8808360 h=--- v=--- V:[UIWindow:0x744db00(480)],
  NSLayoutConstraint:0x71286d0 UIView:0x71222c0.bottom == UIWindow:0x744db00.bottom,
  NSLayoutConstraint:0x7128650 V:|-(20)-[UIView:0x71222c0]   (Names: '|':UIWindow:0x744db00 ),
  NSLayoutConstraint:0x7120c50 UIImageView:0x7451630.bottom == UIScrollView:0x71206f0.bottom,
  NSLayoutConstraint:0x7120c90 V:|-(0)-[UIImageView:0x7451630]   (Names: '|':UIScrollView:0x71206f0 ),
  NSLayoutConstraint:0x7120bd0 UIImageView:0x7451630.centerY == UIScrollView:0x71206f0.centerY,
  NSLayoutConstraint:0x7122a50 V:|-(10)-[UIScrollView:0x71206f0]   (Names: '|':UIView:0x71222c0 ),
  NSLayoutConstraint:0x7122940 V:[UIScrollView:0x71206f0]-(38)-|   (Names: '|':UIView:0x71222c0 )</p>
  
  <p>Will attempt to recover by breaking constraint 
  </p>
  
  <p>Break on objc_exception_throw to catch this in the debugger.
  The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.</p>
  
  <p>I tried doing a google search for this problem but I am not getting good results. The code I am using is as follows. Help is greatly Appreciated</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view, typically from a nib.
  
      // set the tag for the image view
      [self.imageView setTag:ZOOM_VIEW_TAG];
  
      // calculate minimum scale to perfectly fit image width, and begin at that scale
      NSLog(@"[imageScrollView frame].size.width : %f",[self.scrollVIew frame].size.width);
      NSLog(@"[imageView frame].size.width : %f",[self.imageView frame].size.width);
  
      NSLog(@"[imageScrollView frame].size.height : %f",[self.scrollVIew frame].size.height);
      NSLog(@"[imageView frame].size.height : %f",[self.imageView frame].size.height);
  
      float minimumScale = [self.scrollVIew frame].size.width  / [self.imageView frame].size.width;
      minimumScale = 300.0/1200.0;
  
      NSLog(@"minimumScale : %f",minimumScale);
  
      [self.scrollVIew setMinimumZoomScale:minimumScale];
      [self.scrollVIew setZoomScale:minimumScale];
  
      NSLog(@"imageScrollView.zoomScale : %f",self.scrollVIew.zoomScale);
      NSLog(@"imageScrollView.minimumZoomScale = minimumScale : %f",self.scrollVIew.minimumZoomScale = minimumScale);
  
      self.scrollVIew.contentSize = CGSizeMake(1200.0, 800.0);
      self.scrollVIew.delegate = self;
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
      return [self.scrollVIew viewWithTag:ZOOM_VIEW_TAG];
  }
  </code></pre>
  
  <p>Vivek</p>