UIButton 标题和图像的不同对齐方式 [英] UIButton different alignment for title and image

查看:30
本文介绍了UIButton 标题和图像的不同对齐方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在创建同时显示图像和标题的 UIButton.我希望标题和图像都居中,按钮在图像上方.问题是,由于按钮字符串的本地化,字符串长度正在发生变化,并且 UIStoryboard 与边缘插入的对齐方式无法正常工作,因为我希望它能够正常工作.有人可以帮助我并指出正确的方向吗?

Hello I am creating UIButton which is displaying image and title at the same time. I want title and image to be both centred, button to be above image. Problem is that because of localisation of string from button, string length is changing, and alignment from UIStoryboard combined with edge insets is not working as I want it to work. Can someone help me and point me in the right direction?

推荐答案

设置这两个.1.设置UIButton的Align控件

set these two. 1. set Align controls of UIButton

  1. 设置 UIButton 的图像和文本插入

这篇关于UIButton 标题和图像的不同对齐方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆