Eli Waxman
Eli Waxman

Reputation: 2897

Segue from code doesn't work

I've created a segue from one VC to another VC (Dragging form the VC to the other VC), and called it RegisterUserSegue , its a Push segue and all my view controllers are embedded in a navigation controller. I'm calling the segue like this:

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

and in performSegueWithIdentifier I've set an NSLog that is called every time I call the segue, but the viewController doesn't change.

EDIT: however if i comment out the - (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender method, everything works just fine.

This is the method:

- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
    NSLog(@"Called");
}

help? thanks!

Upvotes: 0

Views: 154

Answers (1)

Paulw11
Paulw11

Reputation: 114783

By implementing prepareForSegueWithIdenitifer you have overridden the default implementation in UIViewController with a method that does nothing (except write to the log).

You could use -

- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
    [super performSegueWithIdentifier:identifier sender:sender];
    NSLog(@"Called");
}

But you typically do not override this method. If you want to pass properties through to the destination view controller you would use prepareForSegue:sender:

Upvotes: 4

Related Questions