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??

1
  • 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 3, 2016 at 22:41

1 Answer 1

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.