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