I have made a custom tableviewcell
and override the method
-(void) setEditing:(BOOL)editing animated:(BOOL)animated
so as to hide a UISwitch
for the editing mode.
This is my code
-(void) setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing:editing animated:animated];
if (animated==YES) {
// With animation
if (editing == NO) {
// Editing stopped
[UIView animateWithDuration:0.3
animations:^{
[self.alarmSwitch setAlpha:1.0];
}];
[self.alarmSwitch setEnabled:YES];
} else {
// Editing started
[UIView animateWithDuration:0.3
animations:^{
[self.alarmSwitch setAlpha:0.0];
}];
[self.alarmSwitch setEnabled:NO];
}
} else {
// Without animation
// .................
}
}
In ios 5.0 this worked. From ios 5.1 and later it stopped showing again the alarmSwitch. Here are some screenshots.
1) EDITING MODE
2) AFTER EDITING (IOS 5.0)
3) AFTER EDITING (IOS 5.1 and later)
If i scroll up and then scroll down (so as to redraw the cell) the switch is presented again. Does anybody have any idea why this could happen? It is strange that in iOS 5.0 worked like a charm and now it doesn't work.