I have two methods :
- (void)tableView: (UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath
{
testNumber=indexPath.row;
testNumber=testNumber+1;
NSLog(@"Test number : %i",testNumber);
}
then
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([[segue identifier] isEqualToString:@"testStart1"])
{
tViewController *tvc = [segue destinationViewController];
tvc.testNumberTVC=testNumber;
}
}
I have got also a segue who is triggered by selecting a row in my UITableView
.
My problem is when I select a row, prepareForSegue is acting before didSelectRowAtIndexPath so the new value of testNumber
is not transferred.
I would like to implement prepareForSegue only when didSelectRowAtIndexPath is done or better: Transfer the value of testNumber using only didSelectRowAtIndexPath method and so removing prepareForSegue method.
I've seen few topics about transfering data from UITableView
to DetailView but with the new xCode 5, when an error message appears, I don't really know if this is because solution is outdated or if there is a real error is my code.