Search code examples
iosuitextviewnsattributedstring

Attribute ranges of characters in a UItextview with NSAttributedString?


I have the following text in a UITextview

Hello! The car to your top right is where you setup your car specifications - don't worry, it takes only 30 seconds and you only ever have to set it up once!

I would like to:

  1. bold the "Hello!" and make it a size bigger to 17
  2. underline the "only 30 seconds"
  3. make the "once!" red.

How do I do this? I have very minimal knowledge with NSAttributedString and have had no luck with the documentation.

Thankyou


Solution

  • If you want to achieve this via storyboard, select the UITextView & Goto the Attributes Inspector. then look at the below image

    enter image description here

    If in programmatically , Check these link && Here: