Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

How to Change text font UITextView- Text loaded from array?

I have a UITextView, the text is loaded from an array into the textView when th app is loaded. How can I change the font, colour and size of the text?

Language-Swift

Hiya!

How do you want to change these properties? In response to an event, such as a button click?

Steve.

Hey, When the view loads, the elements in the array are loaded into the textView, I want the text to be the font I chose. So basically when the text loads it must be a different font, size and colour.

2 Answers

You can change the font size, color etc in the attributes inspector when you sepect your storyboard.

Steve.

i did that, but when the text loads from the string it appears in the default size, colour and font.

You can also amend the properties programatically.

var font: UIFont!
var textColor: UIColor!

I'll have a mess about with these to see if I can get them to work.

Steve.