【问题标题】:UiTableview Sequeing with didselectrowAtindex returns previous selection?带有 didselectrowAt 索引的 UiTableview 排序返回先前的选择?
【发布时间】:2012-08-29 09:14:51
【问题描述】:

我希望有人可以帮我解决这个问题。我在这里做错了什么。我试图继续查看详细信息。问题是我第一次选择它时,它返回一个 nil 值,第二次、第三次等它返回我之前选择的值。

希望有人能帮帮我。

非常感谢。

您好,

贾科

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

      NSInteger section = [indexPath section];
      NSArray *HS = [sect objectForKey:[alles objectAtIndex:section]];
      passString = [HS objectAtIndex:indexPath.row];

   }


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

     SiTDetailViewController *vcTarget = [segue destinationViewController];

    vcTarget.mijnString = passString;

  }

【问题讨论】:

    标签: ios5 uitableview segue didselectrowatindexpath


    【解决方案1】:

    呵呵……想通了。我有点傻,“延迟”是因为我同时使用了 seque 和 didSelectRowAtIndexPath。 这就是它的工作原理:

    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    
      NSIndexPath *path = [self.tableView indexPathForSelectedRow];
      NSArray *HS = [sect objectForKey:[alles objectAtIndex:path.section]];
      passString = [HS objectAtIndex:path.row];
      SiTDetailViewController *vcTarget = [segue destinationViewController];
      vcTarget.mijnString = passString;
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-15
      • 2019-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-24
      相关资源
      最近更新 更多