ios - 从可变数组访问数据

标签 ios objective-c

我有一个包含 16 个对象的可变数组 { arrayname == colA },我想单独访问这些元素并想将它放在 tableviewcell 的标签中,我已经完成所有操作并且能够访问数据,但是最后它显示了一个错误,如“由于未捕获的异常‘NSRangeException’而终止应用程序”...

我完成的代码是:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
      EasyTamilTeacherTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
          easyTamil = [colA objectAtIndex:indexPath.row];
          cell.inputLabel.text = easyTamil;
      }
      return cell;
}

最佳答案

非常基本:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    EasyTamilTeacherTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];  
// Other cell settings  

 cell.inputLabel.text= [colA objectAtIndex:indexPath.row];

return cell;
}

关于ios - 从可变数组访问数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38141472/

相关文章:

ios - 防止 UIScrollView 向上移动超过起始位置

ios - 如何在过期之前获取新的 Facebook SDK 访问 token ?

ios - 获取地址簿权限会使应用程序 iOS 崩溃

ios - 浏览速度过快出现连接错误

objective-c - "-Weverything"在每个 NSAssert 处发出 "Varargs argument missing, but tolerated as an extension"警告

objective-c - Objective-C : where to declare private instance properties?

ios - UITableView indexPath 弄乱了我的数组

ios - 后退按钮在 subview Controller 中不可见

Objective-C:为什么我的对象被实例化为 __NSMallocBlock__?

ios - 访问容器 View 中的另一个 View Controller 的 IBOutlets