         super.viewDidLoad()
         trimmedImage = image
         segment.selectedSegmentIndex = 0
+        viewMain.addSubview(borderView)
         updateUI()
     }
     

            }
        case .Ended:
            xform = self.viewMain.transform
            if xform.a < 0.5 {
                setTransformAnimated(CGAffineTransformIdentity)
            }
            boundCheck()
        default:
            self.viewMain.transform = xform
        }
    }
    
    func boundCheck() {
        let size = trimmedImage.size
        let data = NSMutableData(length: 4 * Int(size.width) * Int(size.height))!
        //let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.PremultipliedLast.rawValue)

        // Dispose of any resources that can be recreated.
    }
    
    private func setTransformAnimated(xform:CGAffineTransform, completion:((Bool) -> Void)? = nil) {
        self.xform = xform
        UIView.animateWithDuration(0.2, animations:{
            self.viewMain.transform = xform
        }, completion: completion)
    }

    @IBAction func done() {
