I have a table, I have cellForRowAtIndexPath delegate for it and I have instance of UITableViewCell being created inside that method, which I return. Somewhere in cellForRow
It appears that the button is somehow inheriting the selected state as its highlighted state. Anyone ever find a solution to this?
SOLUTION: I'm not exactly happy about this hack but it works for my purposes. Basically, I want the button to appear only when the cell is selected. Subclass the UITableViewCell and add these overrides (editButton is the button instance that was added to the cell's contentView in init).
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
editButton.hidden = YES;
[super setSelected: selected
animated: animated];
editButton.highlighted = NO;
if (selected)
[editButton performSelector: @selector(setHidden:)
withObject: nil
afterDelay: 0.2];
}
- (void)setSelected:(BOOL)selected {
editButton.hidden = YES;
[super setSelected: selected];
editButton.highlighted = NO;
if (selected)
[editButton performSelector: @selector(setHidden:)
withObject: nil
afterDelay: 0.2];
}