I've been wondering, is there a nice way to make `UIButtons` with multi-line `titleLabel` in Interface Builder? I've found none and puttin a separate `UILabel` on top of each button and tracking it's color on press and other events is not very straightforward. 

Maybe there are better alternatives done in code if there's no such way in IB?
['https://Stackoverflow.com/questions/18659832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1313939/']
**Code:**

To allow multiple line you can use:

```
button.titleLabel.lineBreakMode = UILineBreakModeWordWrap;
button.titleLabel.textAlignment = UITextAlignmentCenter;
[button setTitle: @"Line1\nLine2" forState: UIControlStateNormal];

```

In **iOS 6**, `UILineBreakModeWordWrap` and `UITextAlignmentCenter` are deprecated, so use:

```
button.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
button.titleLabel.textAlignment = NSTextAlignmentCenter;

```

**Interface Builder:**

* In interface builder select *UIButton*
* on the right side Utilities pane under *Attributes Inspector*, you'll see an option for *Line Break*
* Choose *Word Wrap*
In the case you are using only plain XCode 9.4:

Set Line Break to any option (to enable numberOfLines) in the Attributes inspector:

[![The first step in XCode](https://i.stack.imgur.com/Q1Rd1.png)](https://i.stack.imgur.com/Q1Rd1.png)

Then you can set KeyPath as

```
titleLabel.numberOfLines

```

in the Identity inspector:

[![The second step in XCode](https://i.stack.imgur.com/5oZoM.png)](https://i.stack.imgur.com/5oZoM.png)