1. 程式人生 > >ios cell多選

ios cell多選

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

NSArray *value = [selectValueDictionaryallKeys];

if ([valuecontainsObject:inv.uuid])

    {

       cell.accessoryType =UITableViewCellAccessoryCheckmark;

    }else

    {

        cell.accessoryType

=UITableViewCellAccessoryNone;

    }


}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

UITableViewCell *cell = [self.tableView

                             cellForRowAtIndexPath: indexPath ];

if (cell.accessoryType ==UITableViewCellAccessoryNone){

        cell.

accessoryType =UITableViewCellAccessoryCheckmark;

        [selectValueDictionary setObject:indexPath forKey:[jobWelfareArrayobjectAtIndex:indexPath.row]];

    }

    else{

        [selectValueDictionaryremoveObjectForKey:[jobWelfareArrayobjectAtIndex:indexPath.row]];

        cell.accessoryType =UITableViewCellAccessoryNone;

    }

    [self.tableViewdeselectRowAtIndexPath:indexPathanimated:YES];

}