在目标c的表视图中加载时,单元格的选择正在重复

问题描述 投票:0回答:1

滚动表格视图时,重复显示uitableview单元的刻度按钮选择。并且tableview已经加载了item数组。但我需要在tableview中对单元格进行多重选择

-(void)checkButtonClicked:(UIButton *)sender{

CGPoint touchPoint = [sender convertPoint:CGPointZero toView:_tableView];
  NSIndexPath *indexPath = [_tableView indexPathForRowAtPoint:touchPoint];
    sender.tag = indexPath.row;
    selectedIndexForPassing = sender.tag;
    if([_selectionArray count ] == 0){
  _uploadSheetBtn.enabled = NO;
if (sender.selected){
    sender.selected = false;

}
else{
    TCSTimeSheet * sc = self.timesheetList[selectedIndexForPassing];
    _canEdit = sc.canEdit;
    if([_canEdit  isEqual: @"1"]){
    sender.selected = true;
    _uploadSheetBtn.enabled = YES;


    TCSTimeSheet * sc = self.timesheetList[selectedIndexForPassing];

    NSDictionary * detailsDictionary= [NSDictionary dictionaryWithObjectsAndKeys:sc.timesheetDetailId,@"timesheetDetailId",sc.scheduleEmployeeDetailId, @"scheduleDetailId",sc.lastUpdatedTime,@"lastUpdatedTime",sc.timesheetStatus,@"timesheetStatus",sc.shiftDate , @"shiftDate",sc.employeeId ,@"employeeId",nil];

    [_storingArray addObject:detailsDictionary];

    [_selectionArray addObject:sc.clientId];
    }

}

}
objective-c uitableview cell selection repeat
1个回答
0
投票

单元将重用,但模型不会,视图状态应记录在模型中

© www.soinside.com 2019 - 2024. All rights reserved.