【发布时间】:2021-10-16 13:13:36
【问题描述】:
大家好,我想通过这个tableView.isPagingEnabled = true 在 tableview 上得到一些帮助,当我称之为他工作但他没有移动到全高的下一个单元格时,我如何使用它并移动到全高的下一个单元格,
这是我的代码:
import UIKit
private let id = "ss"
class TableView:UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UITableViewCell.self, forCellReuseIdentifier: id)
tableView.isPagingEnabled = true
}
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 16
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: id, for: indexPath)
cell.backgroundColor = .red
return cell
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 755
}
}
我希望我的单元格像 tiktok 单元格一样,当我向下滑动时,他会移动到全高的下一个单元格,
谢谢
【问题讨论】:
-
什么是755,应该看你的屏幕尺寸吧?