UIImagePickerController允许编辑问题

时间:2014-12-09 22:28:26

标签: ios xcode swift uiimagepickercontroller

我正在使用UIImagePickerController通过相机拍摄图像,并将allowsEditing设置为true我希望将图像裁剪为完美的正方形,例如Instagram等。我知道自iOS 6以来一直存在一个错误,导致裁剪框无法被拖动。我一直在寻找一个如何使我想要发生的事情的解决方案,除了我在Swift中找不到任何东西。有谁知道我应该在哪里看。顺便说一下代码是这样的:

if(UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera)){
    //load the camera interface
    var picker : UIImagePickerController = UIImagePickerController()
    picker.sourceType = UIImagePickerControllerSourceType.Camera
    picker.delegate = self
    picker.allowsEditing = true
    self.presentViewController(picker, animated: true, completion: nil)
    self.resetBottomBar()
}else{
    //no camera available
    var alert = UIAlertController(title: "Error", message: "There is no camera available", preferredStyle: .Alert)
    alert.addAction(UIAlertAction(title: "I Kno.", style: .Default, handler: {(alertAction)in
    alert.dismissViewControllerAnimated(true, completion: nil)
    }))
}

0 个答案:

没有答案