ios tableview 那些事(二十六)UITableViewController 多选操作

来源:互联网 发布:java课设心得体会 编辑:程序博客网 时间:2024/06/06 01:07

- (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];

}

0 1