3

I have a ViewController with an UITextView on it. I have several paragraphs in UITextView and am trying to give different fonts and colors on each paragraph. In the last paragraph, I made it center aligned and changed the color to red. Just the last paragraph.

Here is a change I made in storyboard: enter image description here

And below image is what I see in storyboard. You can see the change is correctly being made. enter image description here

However, when I run the app the changes I made (center aligned, red color) are applied to all paragraphs in the textview when I only made the changes on one paragrpah. Is there a way to make changes only on certain parts of the text in UITextView??

Kahsn
  • 1,045
  • 3
  • 15
  • 25
  • 1
    It would appear that attributed strings are just **totally broken**. Whatever you do in storyboard, simply does not appear in the app. it's a disaster. The "selectable" workaround does not work for me. – Fattie Jul 03 '16 at 22:41

1 Answers1

2

I don't have Xcode with me right now, but I feel it might have to do with a bug in Xcode where setting attributed text in IB either doesn't work or gives the wrong result. Try the solutions here (which sadly still apply to iOS 9/Xcode 7), or if that doesn't work, you may have to just do it programatically (using NSAttributedString to set the text on the text view).

Community
  • 1
  • 1
Dominic K
  • 6,975
  • 11
  • 53
  • 62