Vertical text in a Horizontal UIButton

前端 未结 5 1804
借酒劲吻你
借酒劲吻你 2021-01-21 10:01

I\'m using a vertical UIButton in a portrait app (Just a normal button that is of width 60 and Height 160)

I want to put the label Vetically down the button instead of a

5条回答
  •  不思量自难忘°
    2021-01-21 10:38

    For an easy way round do the following settings for the button in the Attributes inspector:

    • Type: Custom
    • Title: Attributed

    Next, select left/middle/right or justified alignment. Do not use 'Align Natural'.

    Now

    [workPackageButton.titleLabel setTransform:CGAffineTransformMakeRotation(M_PI / 2)];
    

    works as expected with the label not being abreviated (but always being center aligned ...).

    Tested with XCode 6.3.

提交回复
热议问题