i´m trying to do like a treeview with a tableview to select multiple items do you know any other way to do a treeview?
I'm trying to give permissions to the user of cameras from different providers
How can i select all childrs from a UIButton on the header section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
CGRect frame = tableView.frame;
UIButton *selectButton = [[UIButton alloc] initWithFrame:CGRectMake(0, -5, 40, 40)];
[selectButton setImage:[UIImage imageNamed:@"ic_combobox_off"] forState:UIControlStateNormal];
[selectButton addTarget:self action:@selector(headerSelected:) forControlEvents:UIControlEventTouchUpInside];
UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(40, 0, 200, 30)];
title.text = [_dataProviders objectAtIndex:section];
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
[headerView addSubview:selectButton];
[headerView addSubview:title];
[headerView setBackgroundColor:UIColor.lightGrayColor];
return headerView;
}
- (void) headerSelected:(NSInteger) section { }
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
VideoPermissionsServiceTableViewCell *cell = (VideoPermissionsServiceTableViewCell*) [tableView dequeueReusableCellWithIdentifier:CELL_VIDEO_PERMITION forIndexPath:indexPath];
NSString *sectionTitle = [_dataProviders objectAtIndex:indexPath.section];
NSArray *sectionDevice = [_dataInput objectForKey:sectionTitle];
NSString *device = [sectionDevice objectAtIndex:indexPath.row];
cell.deviceLabel.text = device;
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
return cell;
}
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSString *providers = [_dataProviders objectAtIndex:section];
NSArray *devices= [_dataInput objectForKey:providers];
return [devices count];
}