我有一个tableView。如果我点击单元格,它会开始用UIActivityIndicator
动画下载文件。下载完成后,出现勾号(文件存在),用户可以移动到下一个控制器。必要的是,移动到下一个控制器并返回所有复选标记消失。怎么做?删除选中标记
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: [NSString stringWithFormat:@"Cell%d", indexPath.row] forIndexPath:indexPath];
if (indexPath.row == 1){
if (!fileExists) {
[_spinner startAnimating];
}
if (fileExists) {
cell.accessoryView = nil;
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
if (indexPath.row == 2){
if (!fileExists1) {
[_spinner1 startAnimating];
}
if (fileExists1) {
cell.accessoryView = nil;
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 1) {
if (!fileExists) {
_spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
_spinner.frame = CGRectMake(0, 0, 24, 24);
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryView = _spinner;
tableView cellForRowAtIndexPath:indexPath].accessoryView = _spinner;
[_spinner startAnimating];
if (fileExists) {
[tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark;
}
}
}
}
能否请你添加更多的代码,比如'cellForRowAtindexPath'和'didSelectRowAtIndexPath'。 –
@用户检查答案,这是您的要求吗? – aircraft
@NiravD我更新我的问题。请检查。 – user