harryisaac
harryisaac

Reputation: 1141

Navigation Controller Turns Black on PopViewController

I have an app in which I have a navigation controller, a root view, and one view that the root pushes to via segue. I'm not doing anything advanced and I am not calling the segue multiple times, but when I pop the second view controller for the second time, the screen goes black and I have to force quit the app. To summarize, when I open the app, I press a button which pushes to the second view, I pop that back to the root view which works fine, but when I do that again the whole screen turns black. Has anyone experienced this before or know how I can fix it?

Thanks for any help.

This is the code that I use to show the controller

    [self performSegueWithIdentifier:@"showSecondView" sender:self];

And this is to close the second view

    [self.navigationController popViewControllerAnimated:YES];

Upvotes: 2

Views: 1726

Answers (1)

harryisaac
harryisaac

Reputation: 1141

Turns out I was actually performing the segue twice only on the second time though. The problem was that using a NSNotificationCenter notification in a subview of the root view to tell the root view to segue, but not unregistering the observer such that when the root view returned I subscribed to the notification again. That meant that the segue ended up being called twice on the second time because the notification was received twice.

Upvotes: 2

Related Questions