在按钮中更改属性标题的位置 [英] Change position of attributed title in button
问题描述
如您所见,我希望标题位于图像下方,并且两者都水平居中。小心,它们是按钮的组成部分。我尝试更改界面构建器上的插入值,但它不能与其他屏幕一起使用(我使用自动布局),它搞砸了。
As you see, I want the title is under the image and the both of them center horizontally. Be careful, they are components of a button. I tried changing inset value on interface builder but it didn't work with others screen (I use auto layout), it messed up.
我可以通过IB使用或必须硬编码
Can I do it by using IB or have to "hard code"
推荐答案
它很简单,只需添加一个按钮就可以将其更改为自定义类似下方的图像,并将标题设置为设置
in interface builder it is easy, just add a button change it to type custom like below image and also title as settings
并设置按钮的图像,我将其设置为 settingsButton.png
。
and set the image for your button, i set it as settingsButton.png
.
现在你需要设置对齐,例如,
now u need to set alignment for example,
现在你可以为图像和标题设置昆虫,为图像设置昆虫你为图像<选择
边缘
/ code>如下图所示,并调整昆虫
now u can set the insects for image and title, to set insect for image u select the edge
for image
like below image, and adjust the insect
和标题,现在为 title
选择 edge
并调整昆虫,如下图所示,
and for title, now select edge
for title
and adjust the insect like below image,
现在你的按钮看起来如下所示,
and now your button looks something like below,
希望这有助于你:)
这篇关于在按钮中更改属性标题的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!