Wednesday, April 18, 2012

New IOS5 UISwitch doesn't look disabled in a UITableViewCell

I'm placing a UISwitches in UITableViewCells and I try to disable it initially:



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
...
self.switch = [[UISwitch alloc] init];
self.switch.enabled = NO;
cell.accessoryView = self.switch;
...
}


In IOS versions prior to IOS5, the (old-looking) switch is disabled and also looks disabled (dimmed) when the view appears.



In IOS5 the (new-looking) switch is disabled alright, I can't flip it, but it does not look disabled at this stage. It has the same brightness as an enabled switch.



If I enable and re-disable it later in the code (NOT in the cellForRowAtIndexPath: callback), it does look disabled (dimmed).



Am I doing something wrong or is this a bug in IOS5?





No comments:

Post a Comment