Sauvik Dolui
Sauvik Dolui

Reputation: 5660

First method after touching a table view cell didSelectRowAtIndexPath or prepareforSegue?

I have designed a table view of various books in sections according to their type.If user touches on cell ,a segue is performed to a new view controller which needs a book item.I have initialised this book in

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 

method.But after a touched is method is not called first,the following method is called first!!!!

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

What is is the first method called after touching a table view cell....?

Upvotes: 0

Views: 584

Answers (1)

Sergey Demchenko
Sergey Demchenko

Reputation: 2954

I think you have to link segue not with cell but with view of the current view controller. In such case when you click on cell

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

will not be called. Then in

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 

you can manualy perform segue:

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

Upvotes: 1

Related Questions