[英]UIButton image doesn't have the right size on simulator
I having a problem while setting an image on a UIButton. 在UIButton上设置图像时遇到问题。 Check the image below: 查看下面的图片:
As you can see on the first image, on the left side is how the image is displayed on Xcode and on the right side how is displayed on the simulator, which is smaller. 如您在第一张图像上看到的,左侧是Xcode上图像的显示方式,右侧是较小的模拟器上的图像显示方式。
The second image is for reference, it shows how is displayed on different screen sizes on Xcode. 第二张图像仅供参考,它显示了如何在Xcode上以不同的屏幕尺寸显示。
Any ideas on what is going on? 有什么想法吗?
I just added a button to the view and this button has constrains on all sides, just in case anyone is wondering. 我只是在视图中添加了一个按钮,此按钮在所有方面都有约束,以防万一有人想知道。
Thanks 谢谢
Just a hunch but it may be something to do with retina and non-retina image sizes. 只是预感,但这可能与视网膜和非视网膜图像大小有关。 Try this. 尝试这个。
尝试在图像名称后添加@ 2x
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.