Я хочу, чтобы представление загружалось с изображением по умолчанию и позволяло пользователю нажимать на это изображение, чтобы выбрать другое из библиотеки фотографий. Я делаю так, но жест нажатия не работает, что я делаю неправильно?Как представить UIImagePickerController из UIImageView с помощью жестов Tap
class ProfileViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
let imagePicker = UIImagePickerController()
@IBOutlet var profilePicture: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
let tap = UITapGestureRecognizer(target: self, action: Selector("selectProfilePicture"))
profilePicture.addGestureRecognizer(tap)
imagePicker.delegate = self
}
func selectProfilePicture() {
imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
imagePicker.allowsEditing = false
self.presentViewController(imagePicker, animated: true, completion: nil)
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
self.dismissViewControllerAnimated(true, completion: nil)
profilePicture.image = image
}
}