0
我发现了一个示例,我试图将我的头包裹起来,我有一个子视图,它将从我的在线资源的值加载到uitableview单元的部分中。现在我想捕获单元格选择并将该数据传回给选定的父视图单元格。我认为这个例子是我需要得到它的工作,但我努力去理解这个例子中的一些变量,希望有人能够帮助我更好地理解它。如何将单元格选择加载到父项中uitableview
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// do usual stuff here including getting the cell
// determine the data from the IndexPath.row
if (data == self.checkedData)
{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// determine the selected data from the IndexPath.row
if (data != self.checkedData) {
self.checkedData = data;
}
[tableView reloadData];
}
我的主要问题是与数据和self.checkedData是数据中的数据从值阵列回来已解析?什么是checkedData?基本上我想在选中单元格的末尾有这些复选标记。
是什么self.checkedData以及如何创建我自己的一个? –
ahh它的tyep indexpath ** @属性(nonatomic,retain)NSIndexPath * checkedData; ** –
如果'checkedData'是一个'NSIndexPath',那么我的回答是正确的。 – rjgonzo