So I'm having issues with the tap gesture for the "Work with View Controllers" section of the tutorial. I'm not getting the image picker to show up when i sumlate or run the app on an iPhone. I think the code is right, because its nearly identical to the sample. I've also rebuilt the app from the beginning of that section 4 or 5 times. I'm pretty sure the @IBOutlet and @IBAction are correctly connected because they have the filled grey circles next to them, but for some reason it won't work. However, I can correctly run the sample. Can anyone think of some issues that might be throwing me off?
import UIKit class ViewController: UIViewController, UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate { // MARK: Properties @IBOutlet weak var nameTextField: UITextField! @IBOutlet weak var mealNameLabel: UILabel! @IBOutlet weak var photoImageView: UIImageView! override func viewDidLoad() { super.viewDidLoad() // Handle the text field’s user input through delegate callbacks. nameTextField.delegate = self } // MARK: UITextFieldDelegate func textFieldShouldReturn(textField: UITextField) -> Bool { // Hide the keyboard. textField.resignFirstResponder() return true } func textFieldDidEndEditing(textField: UITextField) { mealNameLabel.text = textField.text } // MARK: UIImagePickerControllerDelegate func imagePickerControllerDidCancel(picker: UIImagePickerController) { // Dismiss the picker if the user canceled. dismissViewControllerAnimated(true, completion: nil) } func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) { // The info dictionary contains multiple representations of the image, and this uses the original. let selectedImage = info[UIImagePickerControllerOriginalImage] as! UIImage // Set photoImageView to display the selected image. photoImageView.image = selectedImage // Dismiss the picker. dismissViewControllerAnimated(true, completion: nil) } // MARK: Actions @IBAction func selectImageFromPhotoLibrary(sender: UITapGestureRecognizer) { // Hide the keyboard. nameTextField.resignFirstResponder() // UIImagePickerController is a view controller that lets a user pick media from their photo library. let imagePickerController = UIImagePickerController() // Only allow photos to be picked, not taken. imagePickerController.sourceType = .PhotoLibrary // Make sure ViewController is notified when the user picks an image. imagePickerController.delegate = self presentViewController(imagePickerController, animated: true, completion: nil) } @IBAction func setDefaultLabelText(sender: UIButton) { mealNameLabel.text = "Default Text" } }