ios - tableViewCell 中的约束未正确显示

标签 ios swift uitableview uiview constraints

<分区>


想改进这个问题吗? 通过 editing this post 添加细节并澄清问题.

关闭 7 年前

我创建了一个具有动态大小高度的 tableView,如下所示 130.0/320.0 * tableView.bounds.width。在单元格中我必须具有属性。显示图像的 UIimageView 和显示叠加层的 UIView。但是,Overlay UIView 并未覆盖整个图像。这是为什么?

插图

enter image description here

UiView 约束

enter image description here

查看框架

enter image description here

最佳答案

按照我设置的方式设置约束,以按照您的方式重现场景,

ImageView 约束:

enter image description here

将 imageView 高度增加到比单元格高度多 2pts。 (看起来你的图片底部有点透明)

叠加 View :

enter image description here

查看层次结构:

enter image description here

结果是,

enter image description here

关于ios - tableViewCell 中的约束未正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36010949/

上一篇:ios - 如何在文本字段中执行多个自动完成?

下一篇:ios - 如何更改 UINavigationBar rightButton 图像?

相关文章:

objective-c - ios5 - 单击按钮时出现 "EXC_BAD_ACCESS"

ios - 无法在 Podfile 中找到 `pop (~> 1.0)` 的规范

ios - 项目中的 xib 可以使用自动布局而主 Storyboard不使用吗?

ios - 在 View Controller 中播放视频

ios - 如何将第一个值设置为表格颜色

ios - NSFetchedResultsController 在排序时检索特定数据

ios - 创建 UIView 的临时副本

ios - 创建带有动态单元格的tableView并以编程方式设计的方法

ios - SKPhysicsContact 崩溃的扩展

ios - 如何在 iOS 11 中关闭通过 UITableView 调整大标题?