我有一個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