0

I turned an image into a UIgesturerecognizer so that I can press it like a button. When I press it I want it to segue out, but the next view loads a camera so I'm getting kind of a freeze while it's loading. I can't really run an activity indicator because it's going between view controllers. So I made a label that says "please wait..." and I set it to appear on the button press before the segue. The problem is that it isn't actually appearing because the freeze is happening before it actually shows up. Then on the new vc you briefly see it flash, so it is appearing but not quick enough to be efficient. How can I make the label appear, then begin the segue? This is the code right now

@IBAction func buttonTapped(sender: AnyObject) {
    //I want this label to show up before the segue starts happening
    self.loadingLabel.hidden = false
    //Segue       
    self.performSegueWithIdentifier("profilePicCamera", sender: self)
}
Wayne Filkins
  • 494
  • 6
  • 20
  • in which method/func do you load the camera in the next controller? – RomOne Jul 27 '16 at 02:42
  • Post the code where you add the gesturerecognizer and the method that is being called. – ebby94 Jul 27 '16 at 04:00
  • Probably you should show that loadingLabel in the NEXT vc, not the current one, try call it from `loadView` – Tj3n Jul 27 '16 at 05:26
  • I added the gesture recognizer to the image on the storyboard, so it works as a button which segues i think modally without animation. Camera loads up in viewDidLoad but I tried putting it in viewDidAppear and the camera doesn't work. I tried putting the loading label in the next one before this but the freeze is happening before it shows it. I think if I can get the camera working in viewDidAppear that should fix it but it doesn't load the camera for some reason. – Wayne Filkins Jul 27 '16 at 19:30
  • okay got it working by starting camera in viewDidAppear – Wayne Filkins Jul 28 '16 at 00:06

1 Answers1

0

Call your camera load function from the viewDidAppear method.

Bhadresh Mulsaniya
  • 2,610
  • 1
  • 12
  • 25