gpt4 book ai didi

ios - 带有黑边的 UIImageView

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:13:27 41 4
gpt4 key购买 nike

我有一个带有图像的 UIButton,但是,图像似乎移动了,其中一个边缘是黑色

enter image description here

更奇怪的是边缘要么是侧面要么是顶部似乎是随机的

enter image description here

UIButton 已通过 Interface Builder 添加,我已将内容模式设置为 Aspect Fill。另外,在代码中,我设置了以下内容:

self.itemImage.imageView.contentMode = UIViewContentModeScaleAspectFill;

任何想法可能是什么原因?还值得注意的是,这仅发生在设备上(iPhone 6、iOS8.4)。正如预期的那样,在模拟器上没有黑边。

最佳答案

试试这个....

self.itemImage.imageView.contentMode = UIViewContentModeCenter;

关于ios - 带有黑边的 UIImageView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31855644/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com