0
我遇到了保留屬性NSMutableString的問題。我有一個UITableView,每個UITableViewCell都有一個屬性文本。設置屬性文本沒有問題,但在選擇時,UITableViewCell的屬性會丟失。這是我在的cellForRowAtIndexPath,設置屬性代碼:NSMutableAttributedString UILabel在選擇時沒有保留其屬性
NSMutableAttributedString *changesStyleString_h = [[NSMutableAttributedString alloc] initWithString:@"Attributes change!" attributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:20], NSForegroundColorAttributeName:[UIColor yellowColor]}];
[changesStyleString_h addAttributes:@{ NSUnderlineStyleAttributeName:@(1)} range:NSMakeRange(11, 6)];
cell.mainLabel.attributedText = changesStyleString
可能我想指出,mainLabel也是一個UILabel,不需要定製那裏。任何幫助正確的方向將不勝感激!