小编use*_*120的帖子

使用indexPath.row获取数组的键

我有一个表,当我选择一行时,我执行此命令:

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


     InfoClienteViewController *infoViewController = [[InfoClienteViewController alloc] init];
     [self.navigationController pushViewController:infoViewController animated:YES];

     [infoViewController setIdt:idt[indexPath.row]];


    NSLog(@"You Select -> %zd",idt[indexPath.row]);

}
Run Code Online (Sandbox Code Playgroud)

在我的数组(idt)中我有这个值:

  1. [0] - > 2
  2. [1] - > 3
  3. [2] - > 4

所以,当我点击我表格的第一行(现在indexPath.row为[0])时,NSLog显示数字2,但返回数字4451524096,为什么?我该如何解决?

objective-c ios

0
推荐指数
1
解决办法
551
查看次数

标签 统计

ios ×1

objective-c ×1