Is it possible to adjust x,y position for titleLabel of UIButton?

前端 未结 5 677
野趣味
野趣味 2021-01-29 18:25

Is it possible to adjust the x,y position for the titleLabel of a UIButton?

Here is my code:

    UIButton *btn = [UIButton but         


        
5条回答
  •  醉话见心
    2021-01-29 18:34

    The easiest way to do it visually is to use the attribute inspector** (appears when editing a xib/storyboard), setting the "edge" property to title, adjusting it's insets, then setting "edge" property to image, and adjusting accordingly. It's usually better than coding it , since it's easier to maintain and highly visual.

    Attribute inspector setting

提交回复
热议问题