I am seeing something really strange happening on my UITableViewCells containing UILabels with ellipsis (this project is iOS 7 only). I see the ellipsis when the tableView first load. Then, if I press a cell, the text + ellipsis colors change just as I ask it to in my setHighlighted function. But as I release it (wether as I went to the details viewController and came back to the first viewController with the table view, or just pressed and then scrolled to loose the highlight), the ellipsis disappears.
In fact, I found out that it is still there, just that it is white on the white background (the color of the highlight for the text, see the code at the bottom). For a better understanding, here are screens showing what I just described :
Before clicking :
The cell is highlighted while we click :
After clicking, moving to the next viewController and pressing back :
Note that if I do the click + loose the highlight by scrolling, only the cell that was highlighted looses the ellipsis. Also, when scrolling the tableView, all is fine until I reach the bottom of it, and load the next elements of the list - then all ellipsis keeps the white color (and also the highlighted font, which is bold). This lead me to believe that this is caused by something done while reloading the data of the cells.
Here is the code of setHighlighted :
-(void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
NSUInteger fontSize = _titleLabel.font.pointSize;
[UIView animateWithDuration:(highlighted ? .2 : .5)
delay:0
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
_background.backgroundColor = (highlighted ? [UIColor blueND] : [UIColor whiteColor]);
_hourLabel.textColor = (highlighted ? [UIColor whiteColor] : [UIColor blackColor]);
_titleLabel.textColor = (highlighted ? [UIColor whiteColor] : [UIColor blackColor]);
_titleLabel.font = (highlighted ? [UIFont boldSystemFontOfSize:fontSize] : [UIFont systemFontOfSize:fontSize]);
_consoleLabel.textColor = (highlighted ? [UIColor blueND] : [UIColor whiteColor]);
_consoleLabel.backgroundColor = (highlighted ? [UIColor whiteColor] : [UIColor blueND]);
}
completion:nil];
}
Does anyone have a clue as to what is happening here ?
Thank you for your help in advance !
Update : following the comment from Leo Natan, here is the result fo po _titleLabel.attributedString for the highlighted cell, once it has been highlighted, then released :
(lldb) po _titleLabel.attributedText
Mario Golf : World Tour, le Lagon Cheep Cheep en vidéo{
NSColor = "UIDeviceWhiteColorSpace 0 1";
NSFont = "<UICTFont: 0x1669a990> font-family: \".HelveticaNeueInterface-Regular\"; font-weight: normal; font-style: normal; font-size: 14.00pt";
NSParagraphStyle = "Alignment 0, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 4, Tabs (\n 28L,\n 56L,\n 84L,\n 112L,\n 140L,\n 168L,\n 196L,\n 224L,\n 252L,\n 280L,\n 308L,\n 336L\n), DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor 0, HeaderLevel 0";
NSShadow = "NSShadow {0, -1} color = {(null)}";
}
NSAttributedString
somewhere in the code regarding these labels? – Zanepo _titleLabel.attributedText
and post the output here. – ZaneCATextLayer
(the label's layer). – ZaneselectedBackgroundView
, to give selected cells a background view with custom background color. – Zane