UIImageView 正在剪切我的 UIImage 底部的一个像素...?
我不确定可能是什么原因造成的,但是 UIImageView
偶尔会从我用作子视图的某些方形/矩形 UIImages
的底部剪掉大约一个或 2 个像素对于UITableViewCells
。这些 UIImageViews
完全位于单元格的边框内,因此不应该是由于 Cliptobounds 造成的。图像被剪裁的一致性或模式似乎没有一致性或模式,剪裁时也没有一致性或模式,除了它只发生在(或仅在)方形/矩形图标中,并且只有那些以 UITableViewCells
(或其子类)。我无法一致地重现该问题,这就是为什么我这次没有发布任何代码。
以前有人遇到过类似的事情吗?
我遇到过一个类似的错误,其中涉及原点/大小的浮点值被奇怪地解释......但这似乎不是这个特定问题的原因。
此时我不需要特定的解决方案,我只是确保我没有错过任何涉及 UIImageView 的众所周知的错误或已记录的问题。
I'm not sure what might be causing this, but UIImageView
occasionally clips off about a pixel or 2 from the bottom of some square/rectangular UIImages
I'm using as subviews for UITableViewCells
. These UIImageViews
are well within the borders of the cell, so it shouldn't be due to cliptobounds. There seems to be no consistency or pattern to which images are being clipped, nor when they're clipped, other than that it only happens to (or is only noticable in) square/rectangular icons, and only ones that are parented to UITableViewCells
(or their subclasses). I'm having trouble reproducing the problem consistently, which is why I haven't posted any code this time.
Has anyone encountered something similar to this before?
I've encountered a similar bug that involved floating point values for origin/size being interpreted weirdly... but that doesn't seem to be the cause of this particular problem.
I don't need a specific solution at this point, I'm just making sure I haven't missed any well-known bugs or documented problems that involve UIImageView.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的问题,但奇怪的是只有标题单元格中的 imageViews 。我的解决方案是设置图像视图的
contentMode
,一切看起来都如您所期望的那样。imageView.contentMode = UIViewContentModeTop;
I had the same problem but strangely enough only with the imageViews in the header cells. The fix in my case was to set the
contentMode
of the image view and everything looked the way you would expect.imageView.contentMode = UIViewContentModeTop;
也许不是
UIImageView
是原因?如果 UITableViewCell 中有图像并且没有至少 5 像素的“可用空间”,则 UITableViewCell 可能看起来不正常。
尝试在初始化表格时设置
rowHeight
。例如:如果这不能解决问题,请提供模式详细信息。
Maybe not
UIImageView
is the cause?If you have an image in UITableViewCell and you don't at least 5 pixels "free space", the UITableViewCell may not look as it should be.
Try to set the
rowHeight
when you're initializing the table. For ex:If this does't solve the problem, pls provide mode details.