iOS 7中UILabel和UILabel的省略号颜色发生了变化

Cyb*_*ndy 7 ellipsis textcolor uitableview uilabel ios7

我看到包含带省略号的UILabel的UITableViewCells发生了一些非常奇怪的事情(这个项目仅限iOS 7).我在第一次加载tableView时看到了省略号.然后,如果我按下一个单元格,文本+省略号颜色就会像我在setHighlighted函数中所要求的那样改变.但是当我发布它时(当我去了详细的viewController并回到第一个带有表视图的viewController,或者只是按下然后滚动以松开突出显示)时,省略号消失了.

事实上,我发现它仍然存在,只是它在白色背景上是白色的(文本高亮的颜色,见底部的代码).为了更好地理解,这里是屏幕显示我刚才描述的内容:

点击之前:

点击之前

单击时,单元格突出显示:

单元格突出显示

单击后,移动到下一个viewController并按下:

单击后,移动到下一个viewController并按回

请注意,如果我通过滚动单击+松开突出显示,则只有突出显示的单元格会丢失省略号.此外,当滚动tableView时,一切都很好,直到我到达它的底部,并加载列表的下一个元素 - 然后所有省略号保持白色(以及突出显示的字体,这是粗体).这让我相信这是由重新加载单元格数据时所做的事情引起的.

这是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];
}
Run Code Online (Sandbox Code Playgroud)

有没有人知道这里发生了什么?

提前谢谢你的帮助 !

更新:根据Leo Natan的评论,以下是突出显示的单元格的po _titleLabel.attributedString的结果,一旦突出显示,然后发布:

(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)}";
}
Run Code Online (Sandbox Code Playgroud)

Leo*_*ica 6

这可能是系统的一个错误.确保打开错误报告.

正如评论中所设计的那样,您可以使用标签' highlightedTextColor和单元' selectedBackgroundView来实现您尝试的方式,而不是手动设置颜色.