title: Pick from image library button on toolbar gets deactivated
body: <p>I have a simple iOS app that lets me pick an image by pressing a Bar Button Item on the UIToolbar. The issue is that it lets me pick the image for the first time however it gets deactivated afterwards. I am unable to pick any images later. Please note the exact same code works perfectly when I use a UIButton instead of the button on my toolbar. Can somebody please help, I seem to be stuck ?</p>
  
  <p>The logic for picking image -> </p>
  
  <pre><code>@IBAction func pickImage(sender: UIBarButtonItem) {
      print("Picker")
      let controller = UIImagePickerController()
      controller.delegate = self
      if sender.tag == 1 {
           controller.sourceType = UIImagePickerControllerSourceType.Camera
      } else {
          controller.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
      }
  
      self.presentViewController(controller, animated: true, completion: nil)
  
  }
  </code></pre>
  
  <p>Handling the picked image and setting it in my image view -></p>
  
  <pre><code>func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
  
      if let image = info[UIImagePickerControllerOriginalImage] as? UIImage{
          memeImageView.image = image
      }
      dismissViewControllerAnimated(true, completion: nil)
  }
  
  func imagePickerControllerDidCancel(picker: UIImagePickerController) {
      print("On cancel")
      dismissViewControllerAnimated(true, completion: nil)
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/tPtbE.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tPtbE.gif" alt="Gallery button gets deactivated after selecting once"></a></p>