storyboard positioning text below image inside a button

前端 未结 8 1103
野趣味
野趣味 2021-02-01 13:13

I am able to set the image and text for button. But it is aligned horizontally. I want the image and text to be aligned vertically inside the button. i.e., text below the image<

8条回答
  •  伪装坚强ぢ
    2021-02-01 13:41

    Yes you can do it from storyboard without writing any logic also.

    1) Select button and go to Attribute Inspector in your storyboard.

    2) Assign Image to the button. (Don't use background Image)

    3) Set Title text to that button.

    4) Now you need to set edge and Inset so first select image from edge and set Inset as you need and then select title from edge and set inset as per your need.

    Hope this helps.

提交回复
热议问题