0

I am setting three line string title to UIButton. I am using iOS 10. But I can't set it.

What I have tried.

  1. Set the UIButton title Label with the Below String.

    String = "Before\n-\n12:00".

but the \n doesn't break the String to new line.

and also set the UIButton property to WordWrap.

  1. When I set

    noOfLine to TitleLabel of UIButton but noOfLine property is not display.

ScreenShot :

enter image description here

See the ScreenShot :

the First one is UIButton but it is not display well as I accepted.

the Second one is UILabel which is display well as I expected.

I want to set it like second one.

Is there any way to set it like Second One.

Any Help be Appreciated.

Community
  • 1
  • 1
Harshad Pansuriya
  • 20,189
  • 8
  • 67
  • 95

1 Answers1

0

One Solution I found is that below

See the ScreenShot :

enter image description here

In the UIButton set the Title to Attributed and also set the Title to centre.

The Output is As Expected.

Harshad Pansuriya
  • 20,189
  • 8
  • 67
  • 95