本文介绍了UIButton 不显示按钮内的完整图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试设置图像大小为 55*55 的 UIButton(宽度:55,高度:55).但是我设置了图片后,按钮变成这样

I tried to set the UIButton (width:55, height:55) with image size 55*55. But after I set the image, the button becomes this way

小于图像尺寸.我不知道如何使图像填充按钮.谁能给我一个提示?或者我应该改为使用 UIImageview 吗?

Which is smaller than the image size. I don't know how to make the image fill the button. Could anyone give me a hint? Or should I change to UIImageview instead?

推荐答案

你的图像是 2x,所以它看起来很小.

Your image is 2x so that's way it's appearing small.

选项 1要么在 xcassets 中将其移动到 1x.

Options 1Either you move it to 1x in your xcassets.

选项 2如果您想将其保留为 2x.您需要 110 x 110 的高分辨率图像.

Option 2If you want to keep it as 2x. You need high resolution image 110 x 110.

这篇关于UIButton 不显示按钮内的完整图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:50
查看更多