我有一个包含 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/