这里我想显示文件夹或目录的披露指示器:
我的cellForRowAtIndexPath方法:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
DropboxCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Dropbox_Cell2"];
DBMetadata *metadata = [filesNames objectAtIndex:indexPath.row];
[cell.btnIcon setTitle:metadata.path forState:UIControlStateDisabled];
[cell.btnIcon addTarget:self action:@selector(btnDownloadPress:) forControlEvents:UIControlEventTouchUpInside];
if (metadata.isDirectory) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.btnIcon.hidden = YES;
NSLog(@"yes");
}else {
NSLog(@"No");
cell.accessoryType = UITableViewCellAccessoryNone;
cell.btnIcon.hidden = NO;
}
NSString *sectionTitle = [newsectionTitles objectAtIndex:indexPath.section];
NSArray *sectionRows = [dict objectForKey:sectionTitle];
NSString *cellName = [sectionRows objectAtIndex:indexPath.row];
//cell.lblTitle.text = metadata.filename;
cell.lblTitle.text = cellName;
return cell;
}
请参阅图片和帮助。
Rest客户端委托方法,用于加载和操作数据:
表视图的 numberOfRowsInSection
方法:
答案 0 :(得分:0)
由于您返回了多个部分,因此indexPath.row
方法更改中的cellForRow
取决于部分,因此请尝试处理metadata.isDirectory
取决于部分和行而不是仅行,我希望有所帮助你。