Search code examples
iosuibuttonuikitinterface-builder

Button with Image and a label on bottom


I want to make a button which has an icon and a label on the bottom of it so like this:

enter image description here

What would be the best way to do this? Is it possible to drag an image view object and a label into a button?


Solution

  • UIButton has two properties you may find of interest. They are titleEdgeInsets and imageEdgeInsets.

    Use this property to resize and reposition the effective drawing rectangle for the button title. You can specify a different value for each of the four insets (top, left, bottom, right). A positive value shrinks, or insets, that edge—moving it closer to the center of the button. A negative value expands, or outsets, that edge

    You could play around with these to get your desired layout.