stackOverFlew
stackOverFlew

Reputation: 1499

IOS7 - performSegueWIthIdentifier does not have any effect

I have a problem in iOS7 where I am calling a segue with performSegueWithIdentifier (I have code just like this that works just about everywhere else), then I log the segue in prepareForSegue, then I log again the view controller (VC) that the segue is supposed to push to the top.

prepareForSegue gets called appropriately and the segue has the correct string as its identifier property. Yet the VC that it is supposed to push to the top never gets initialized nor viewWillAppear gets called.

The segue I am talking about, which is the only one that does not work (all the other ones work in both ios6 and 7), is the one leading form the center VC to the right VC. By the way, this works flawlessly in iOS6.

What could be the cause?

the code:

-(IBAction)gotoMainMenu:(id)sender{

    DLog(@"DifferentName");

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


}

enter image description here

Upvotes: 1

Views: 2543

Answers (2)

LJ Wilson
LJ Wilson

Reputation: 14427

Get in the habit of not wiring up segue's to buttons. Wire them up to the VC and then in the touchUpInside action, fire off the performSegueWithIdentifier.

Upvotes: 3

Jeno_With_a_J
Jeno_With_a_J

Reputation: 11

I had the same issue and solved it as follows. In view A I had a segue that was triggered by a button (UIButton) and the button was also connected to an action in my controller. When I clicked the button in View A, View B would appear as expected. However, when I tried clicking a button in View B to go to View C nothing happened just as you described above.

In my case the issue was resolved in View A. I removed the segue that was tied to the button and let the IBAction that was associated with the button handle calling the performSegueWithIdentifier, then I created a new manual segue that was only tied to the view and voila things worked as expected again.

In short, I guess make sure you don't have both and action and a segue linked to the same button. Hope this helps.

Upvotes: 0

Related Questions