开发者

UITextView Bold Font iphone sdk

iam trying to bold / italic text but i use this code to bold my font but when i press bold button whole the UITExtView going to bold but i want select some text and bold / italic or change the color of them ..

textPad.font开发者_StackOverflow中文版 = [UIFont boldSystemFontOfSize:12];


You can't. UITextView is all one font. Simplest way to get proper text styling is to use a UIWebView instead.


I know this is an old thread, but this is something I just discovered myself. At least in Xcode version 4.6.3 this is possible by using an attributed textView. What's even better is that it's possible to all be done in Interface Builder!

Here are the steps:

  1. Place your textView at the desired location
  2. Select the textView and open up the Attributes tab under the Utilities panel
  3. Change the textView text to "attributed"
  4. Enter your desired text
  5. Now, highlight whatever text you want bolded, underlined, etc.
  6. Click on the "T" button next to the fontName
  7. In the popup, select your desired typeface (ex: Bold)
  8. You should see the desired typeface displayed in the Utilities panel

Enjoy!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜