Joe
Joe

Reputation: 2633

Which object is the sender while performing a segue?

I have a segue in a table view controller, and I want to declare an identifier in the didDeselectRowAtIndexPath delegate method:

- (void) tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self performSegueWithIdentifier:@"noteSegue" sender:________];
}

But I'm trying to understand who is the sender here...?

Upvotes: 1

Views: 71

Answers (2)

Hampus Nilsson
Hampus Nilsson

Reputation: 6822

It's the object that is passed to prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender, you can pass nil here without worry if you like (and don't implement prepareForSegue).

For segues created in the interface builder, sender will be the object bound to execute the segue.

Upvotes: 2

EmilDo
EmilDo

Reputation: 1177

The sender is also self, it is the instance of the ViewController that is the initial start of the segue and is what you should write if you are using StoryBoards.

Upvotes: 2

Related Questions