This question has been asked several times, but there seems to be no solution for this.
UITableView rewrites hidden background
UITableViewCell subview not showing during reordering
Reordering causing subview highlight color to clear
I have a custom tableview cell with UILabel. When the tableview is in edit mode and I drag the cell to reorder, the UILabel background becomes transparent. I also found that if I try to reorder the selected cell (in my view mode multiple selection is allowed in edit mode), the background color of the subheading will remain.
I tried using the methods in my CustomCell, but none of them overrides the background color of the subtitle when dragging a cell.
I want the background color in subview to remain. Is there any method that I skipped? Or did Apple design it that way?
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
if (selected) {
if (self.isEditing) {
self.customLabel.backgroundColor = [UIColor blueColor];
}
else {
self.customLabel.backgroundColor = [UIColor blueColor];
}
}
else {
self.customLabel.backgroundColor = [UIColor blueColor];
}
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
[super setHighlighted:highlighted animated:animated];
if (highlighted) {
if (self.isEditing) {
self.customLabel.backgroundColor = [UIColor blueColor];
}
else {
self.customLabel.backgroundColor = [UIColor blueColor];
}
}
else {
self.customLabel.backgroundColor = [UIColor blueColor];
}
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
if (editing) {
self.customLabel.backgroundColor = [UIColor blueColor];
}
else {
self.customLabel.backgroundColor = [UIColor blueColor];
}
}
source
share