带有黑边的 UIImageView
UIImageView with black edge
我有一张 UIButton
的图片,但是,图片似乎移动了,有一个边缘是黑色的
更奇怪的是,边缘要么是侧面,要么是顶部,看起来是随机的
已通过 Interface Builder 添加 UIButton
,我已将内容模式设置为 Aspect Fill
。另外,在代码中,我设置了以下内容:
self.itemImage.imageView.contentMode = UIViewContentModeScaleAspectFill;
任何想法可能是什么原因?还值得注意的是,这仅发生在设备上(iPhone 6,iOS8.4)。正如预期的那样,在模拟器上没有黑边。
试试这个....
self.itemImage.imageView.contentMode = UIViewContentModeCenter;
尝试改变背景颜色,看看我们看到的黑边是不是背景。
self.itemImage.imageView.backgroundColor = [UIColor yellowColor];
如果边缘没有变黄,则可能是图片问题。
我有一张 UIButton
的图片,但是,图片似乎移动了,有一个边缘是黑色的
更奇怪的是,边缘要么是侧面,要么是顶部,看起来是随机的
已通过 Interface Builder 添加 UIButton
,我已将内容模式设置为 Aspect Fill
。另外,在代码中,我设置了以下内容:
self.itemImage.imageView.contentMode = UIViewContentModeScaleAspectFill;
任何想法可能是什么原因?还值得注意的是,这仅发生在设备上(iPhone 6,iOS8.4)。正如预期的那样,在模拟器上没有黑边。
试试这个....
self.itemImage.imageView.contentMode = UIViewContentModeCenter;
尝试改变背景颜色,看看我们看到的黑边是不是背景。
self.itemImage.imageView.backgroundColor = [UIColor yellowColor];
如果边缘没有变黄,则可能是图片问题。