2013-02-18 56 views
1

我正在iphone sdk中创建TextEditor应用程序。在我的应用程序中,我喜欢在编辑文本时更改用户需要的颜色和字体。为了创建这个我有参考以下一些库如何在IOS中创建多色文本编辑器

  1. 自我的TextView,它允许改变不同字体,但为setColor属性是不可用
  2. RichTextKit - SetKeyboard,setAutoCorrent不可

但非他们是为我工作。任何人都可以提出一些想法在iPhone SDK中创建多种颜色和多种字体的TextEditor?

回答

1

对于多种字体和多种颜色,你可以去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)];