hello genius and nerds
I have a TableViewCell with a UISwitch in accessoryView. I don't want that blue background if someone selected it. There fore i used
cell.userInteractionEnabled = NO;
but then the whole cell isnt accessable so i tried that
cell.userInteractionEnabled = NO;
cell.accessoryView.userInteractionEnabled = YES;
i think this wont work because cell is the parent of the accessoryView. but how can i manage this issue ? A hint in the right direction would be great.
Simon
Here is the complete cellForRowAtIndexPath method:
cell.textLabel.text = @"dasda";
cell.userInteractionEnabled = NO;
cell.accessoryType = UITableViewCellAccessoryNone;
UISwitch *mySwitch = [[[UISwitch alloc] initWithFrame:CGRectZero] autorelease];
mySwitch.tag = row;
[cell addSubview:mySwitch];
cell.accessoryView = mySwitch;
cell.accessoryView.userInteractionEnabled = YES;
[(UISwitch *)cell.accessoryView setOn: YES];
[(UISwitch *)cell.accessoryView addTarget:self action:@selector(someAction:) forControlEvents:UIControlEventValueChanged];
return cell;