Reputation: 1045
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:
And below image is what I see in storyboard. You can see the change is correctly being made.
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??
Upvotes: 3
Views: 2626
Reputation: 7075
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).
Upvotes: 2