 		
 		view.clipsToBounds = true
 		
-		scroll = UIScrollView()
-		scroll.frame = UIScreen.mainScreen().applicationFrame;
-		scroll.contentSize = scroll.frame.size
-		scroll.minimumZoomScale = 0.01
-		scroll.maximumZoomScale = 2.00
-		scroll.delegate = self
-		view.addSubview(scroll)
-		
-		scroll.pinchGestureRecognizer.addTarget(self, action: "pinchUpdated:")
+		preview = UIScrollView()
+		preview.frame = UIScreen.mainScreen().applicationFrame;
+		preview.contentSize = preview.frame.size
+		preview.minimumZoomScale = 0.01
+		preview.maximumZoomScale = 2.00
+		preview.delegate = self
+		view.addSubview(preview)
+		
+		preview.pinchGestureRecognizer.addTarget(self, action: "pinchUpdated:")
+		setPreviewAutoLayout()
 		
 		var tap = UITapGestureRecognizer()
 		tap.numberOfTapsRequired = 2
 		tap.addTarget(self, action: "doubleTapZoom:")
-		scroll.addGestureRecognizer(tap)
+		preview.addGestureRecognizer(tap)
+	}
+	
+	func setPreviewAutoLayout()
+	{
+		var views:[NSObject:AnyObject] = [:]
+		views.updateValue(preview, forKey: "preview")
+		
+		preview.setTranslatesAutoresizingMaskIntoConstraints(false)
+		view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[preview]|", options: NSLayoutFormatOptions.AlignAllCenterX, metrics: nil, views: views))
+		view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[preview]|", options: NSLayoutFormatOptions.AlignAllCenterY, metrics: nil, views: views))
 	}
 	
 	override func viewWillAppear(animated: Bool)

	
	func doubleTapZoom(gesture:UITapGestureRecognizer)
	{
		let MAX_SIZE_W = zoomView.frame.width / scroll.zoomScale
		
		var scale:CGFloat
		if zoomView.frame.width > scroll.frame.width + 0.0001
		{
			scale = scroll.frame.width / MAX_SIZE_W
		}
		else
		{
			scale = 1.0 / UIScreen.mainScreen().scale
		}
		
		scroll.setZoomScale(scale, animated: true)
	}
	
	func pinchUpdated(gesture:UIPinchGestureRecognizer)

		}
		
		zoomView = UIImageView(image: image)
		preview.addSubview(zoomView)
		
		updateBackgroundImage()
		
		preview.zoomScale = 0.01
		
		repairImageZoom(useAnimation: true)
		alignImageAtCenter()
	}
	
	func updateBackgroundImage()
	{
		if background != nil && background.superview != nil
		{
			background.removeFromSuperview()
