Image not align at center on UIButton
I have customized UIButton with the following properties:
but my image is always aligned to the left. How can I align it back to center position on the UIButton?
I have a title on my button that is hidden (clearColor). These titles are key_value in a dictionary so I know which button is pressed and return corresponding value in the dictionary. I now understand that it's these text that is pushing my image sideway, but how do I fix that?
Under attribute inspector, there is a tap named Edge, set to Image. I set left value as 22 and all image align to center. Can someone explain to me how this works?
检查titleLabel
是否为空 - 如果它有文本,它会将image
向左推, titleLabel
右侧的titleLabel
腾出空间。
上一篇: 带图像和文字的UIButton
下一篇: 图像不在UIButton的中心对齐