Mc.Lover
Mc.Lover

Reputation: 4994

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 = [UIFont boldSystemFontOfSize:12];

Upvotes: 0

Views: 3586

Answers (2)

ebandersen
ebandersen

Reputation: 2352

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!

Upvotes: 0

Paul Lynch
Paul Lynch

Reputation: 19789

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

Upvotes: 4

Related Questions