swift - UITableViewCells 从底部流血并消失

标签 swift uitableview

我的表格 View 单元格在上一部分中只显示了 4 个中的 3 个。降低它们的高度,就会出现更多。增加行高,出现的次数会减少。

索引路径处的行高度:

返回64

我的表格 View 已创建:

lazy var performanceTableView: UITableView = {
        let tableView = UITableView()
        tableView.dataSource = self
        tableView.delegate = self
        tableView.frame = self.view.bounds
        tableView.separatorStyle = .None
        tableView.scrollEnabled = true
        tableView.backgroundColor = UIColor.backgroundColor()
        tableView.estimatedRowHeight = UITableViewAutomaticDimension
        tableView.backgroundView = nil
        return tableView
    }()

我的表格 View 单元格似乎停在底部,就像我的 View 高度受到限制,粘在框架上......知道为什么吗?

最佳答案

UITableView clipsToBounds 属性默认设置为 true。如果您正在寻找单元格继续穿过 View 框架的底部,您可能需要更改它。

此外,将表格 View 的框架设置为 View 的框架,或创建约束以将此 View 绑定(bind)到边缘。

关于swift - UITableViewCells 从底部流血并消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37733903/

相关文章:

ios - 在 ScrollView 内更新 subview 的高度(没有滚动的 UITableView)后 UIStackView 不更新

ios - 使用核心数据而不是数据模型

ios - 寻址 init 中闭包内创建的实例

macos - 如何在 Swift (MVC) 中引用 Controller

ios - AVAudioPlayer pause() 未按预期运行

ios - 我们可以在不重新加载的情况下调整 UITableViewCell 的大小吗?

ios - 使用 UISearchController 搜索 TableView

ios - 如果显示 2 秒,则将显示的 UITableView 单元格存储在 NSString 中

ios - 在 Swift 中将整数映射到字符串

swift - 车轮沉入地板 - Scenekit(IOS)