简体   繁体   中英

IOS can't navigate from a table view controller to another one

I have a table view controller TeamsViewController and when the user tap on a row, I want to go to TeamTableViewController , which is another table view controller,

This is my code inside the TeamsViewController:

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

    if([segue.identifier isEqualToString:@"Show Team Information"]){
        if ([segue.description isKindOfClass:[TeamTableViewController class]]){
            TeamTableViewController * teamTableViewController = (TeamTableViewController*) segue.destinationViewController;
            [teamTableViewController setTeam:[self.teams objectAtIndex:self.tableView.indexPathForSelectedRow.row]];
        }else{
            NSLog(@"That is why ");
        }
    }
}

Always the That is why is getting printed. Why please? In the current situation, the TeamTableViewController is shown but with no data. I send the data through the setTeam message, which is not executed at all.

Please check the image.

在此处输入图片说明

The cell's identifier and segue's identifier are 100% correct.

Could you help me please?

I appreciate your time and efforts.

Regards,

Change the segue.description to segue.destinationViewController . The description is of class NSString .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM