我有这段代码可以将 DB(sqlite) 文本设置到我的 View 中。我只是使用核心文本在 View 中绘制文本。
NSMutableString *combined = [NSMutableString 字符串];
for(NSUInteger idx = 0; idx < [delegatee.allSelectedVerseEnglish count]; idx++) {
[combined appendFormat:@" %d %@",
idx + 1,
[delegatee.allSelectedVerseEnglish objectAtIndex:idx]];
}
self.multiPageView.text =combined;
delegatee.allSelectedVerseEnglish 这是数组...在文本的每个句子之间我放了这样的数字 1 haii this is nipin 2 haii this is stack overflow 3 etc etc..like that..i am able to change所有文本的文本颜色都包括数字..但我需要将“红色”颜色添加到数字上。如何更改上面代码中数字的颜色。这可能吗? 提前致谢。
最佳答案
您需要使用 NSMutableAttributedString
并使用 setAttributes:range:
method 设置 NSForegroundColorAttributeName
值.
关于iphone - 字体颜色疑惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10372817/