从UIImagePickerViewcontroller加载时出现图像问题

时间:2015-03-11 12:52:45

标签: swift uiimagepickercontroller

我正在编写用户必须注册的应用程序。要注册,用户必须从照片库中选择个人资料照片。我能够加载图像,但比例/大小是错误的。我在70 x 70的故事板中使用PFImage视图。 这是我的代码:

 @IBAction func photoButtonPressed(sender: UIButton) {
    var photoPicker = UIImagePickerController()
    photoPicker.delegate = self
    photoPicker.allowsEditing = true
    photoPicker.sourceType = .PhotoLibrary
    self.presentViewController(photoPicker, animated: true, completion: nil)
}

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
    var image = info[UIImagePickerControllerEditedImage] as? UIImage
    profileImage.image = image
    self.dismissViewControllerAnimated(true, completion: nil)
    self.picker.becomeFirstResponder()
}

Screeshots: Before selecting an image UIImagePickerViewcontroller When an image is selected

0 个答案:

没有答案