我正在编写用户必须注册的应用程序。要注册,用户必须从照片库中选择个人资料照片。我能够加载图像,但比例/大小是错误的。我在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: