我正在 iphone sdk 中创建 TextEditor 应用程序。在我的应用程序中,我喜欢在用户编辑文本时随时更改颜色和字体。为了创建这个,我参考了以下一些库
- Ego TextView-允许更改不同的字体但 setcolor 属性不可用
- RichTextKit - SetKeyboard、setAutoCorrent 不可用
但没有一个对我有用。有人可以提出一些想法来在 iPhone SDK 中创建多种颜色和多种字体的 TextEditor 吗?
我正在 iphone sdk 中创建 TextEditor 应用程序。在我的应用程序中,我喜欢在用户编辑文本时随时更改颜色和字体。为了创建这个,我参考了以下一些库
但没有一个对我有用。有人可以提出一些想法来在 iPhone SDK 中创建多种颜色和多种字体的 TextEditor 吗?
对于多种字体和多种颜色,您可以选择 CG 甚至 NSAttributedString。
NSMutableAttributedString *attributedString = [NSMutableAttributedString attributedStringWithString:@"colorfull text"];
[attributedString setFont:[UIFont systemFontOfSize:15]];
[attributedString setTextColor:[UIColor redColor]];
[attributedString setTextColor:[UIColor greenColor] range:NSMakeRange(3,7)];