//当进行界面切换的(Segue形式)执行 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"ToMessage"]) { MessageViewController *mvc = segue.destinationViewController; mvc.username = @"hanmeimei"; } } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //执行stroyboard切换动作 [self performSegueWithIdentifier:@"ToMessage" sender:self]; }
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //执行storyboard切换动作 //[self performSegueWithIdentifier:@"ToMessage" sender:self]; UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; MessageViewController *mvc = [sb instantiateViewControllerWithIdentifier:@"Message"]; mvc.username = @"lilei"; [self.navigationController pushViewController:mvc animated:YES]; }