Sweeper
Sweeper

Reputation: 274680

How to type a new line in Interface Builder?

I inserted a UITextView into a view controller. I want to set the text to, for example, this:

hello
world

I can just add an outlet to the view controller class and set it like this in viewDidLoad:

myTextView.text = "hello\nworld"

But I want to be able to set it directly in interface builder! So I tried the following and they all didn't work!

I finally tried to write the text somewhere else and copy/paste it into the box and it finally works!

But seriously? Is there a better way to do this?

Upvotes: 0

Views: 135

Answers (2)

Nirav D
Nirav D

Reputation: 72460

In the interface builder use (alt + enter) or (option + enter).

Hope this will help you.

Upvotes: 1

Code
Code

Reputation: 6251

In the interface builder use (option + enter) instead of (shift + enter).

Upvotes: 1

Related Questions