【发布时间】:2013-08-12 12:09:56
【问题描述】:
我对 3 种不同的观点有 3 种不同的看法。 2个实现没问题,第三个创建的时候问题就出现了。
我有以下 didSelectRowAtIndexPath 方法:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSLog(@" ---------- did select row");
if(indexPath.section == 0){
if(indexPath.row == [self.data count]-1){
//prior to adding this, everything works
[self performSegueWithIdentifier:@"MoreComments" sender:self];
}else{
[self performSegueWithIdentifier:@"FriendView" sender:friend];
}
}else if(indexPath.section == 1){
if(indexPath.row == [self.data2 count]-1){
[self performSegueWithIdentifier:@"MorePosts" sender:self];
}else{
[self performSegueWithIdentifier:@"FriendView" sender:friend];
}
}
}
我有以下 prepareForSeque 方法:
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:@"MorePosts"]){
MorePostsViewController *mfamvc = segue.destinationViewController;
mfamvc.data = self.data;
}else if([segue.identifier isEqualToString:@"FriendView"]){
FriendViewController *fvc = segue.destinationViewController;
fvc.friend = friend;
}else if([segue.identifier isEqualToString:@"MoreComments"]){
MoreCommentsViewController *mcvc = segue.destinationViewController;
mcvc.data = self.data2;
}
}
在控制从我的单元格拖动到最后一个视图之前,我可以看到我的程序点击了 didselectrow,然后是 prepareforseque。这使得所有视图导航工作完美。
当我控制从单元格拖动到 MoreCommentsViewController 时,我开始看到错误:
嵌套推送动画可能导致导航栏损坏 在意外状态下完成导航转换。导航栏子视图树可能已损坏。
我注意到现在也调用了两次 prepareforseque,首先调用了 prepareforseque,然后是 didselectrow,然后再次调用了 prepareforsegue。
有条件地去这些不同的观点我做错了什么?
【问题讨论】:
-
segues 的连接方式可能有问题。您能否描述一下您在 IB 中所做的事情或发布指向您的故事板图片的链接?您是否直接从一个单元原型连接多个 segue?如果是这样,那就错了。
-
是的,我正在从一个单元原型连接多个 segue。我想这就是问题
标签: ios interface-builder storyboard segue didselectrowatindexpath