2013-02-18 59 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)];