- (void)viewDidLoad {
[super viewDidLoad];
for (int i = 0; i < resultArr.count; i++) {
CustomStatusModel *model = [[CustomStatusModel alloc] init];
model.isSelect = NO;
[selectArr addObject:model];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
<pre name="code" class="objc">static NSString *statusCell = @"statusCell";
StatusTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:statusCell];
if (cell == nil) {
cell = [[StatusTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:statusCell];
}
CustomStatusModel *model = selectArr[indexPath.row];
if (!model.isSelect) {
cell.img_result.image = [UIImage imageNamed:@"icon_saveFlow_norlmal"];
}
else
{
cell.img_result.image = [UIImage imageNamed:@"icon_saveFlow_selected"];
}
cell.lbl_result.text = resultArr[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
for (int i = 0; i < selectArr.count; i++) {
CustomStatusModel *model = selectArr[i];
if (i == indexPath.row) {
model.isSelect = YES;
}
else
{
model.isSelect = NO;
}
}
[tableView reloadData];
}