gpt4 book ai didi

ios - swift:如何使用 InfiniteScrolling 设置 UITableViewCell 显示全屏(允许分页)

转载 作者:行者123 更新时间:2023-11-30 11:47:43 26 4
gpt4 key购买 nike

我有一个自定义的UITableView,具有无限滚动和分页启用功能。我的每个单元格的背景上都有 UIImageView,我希望每次向上或向下滚动时,它都会全屏显示每个图像。

我使用此功能全屏,但无限滚动一次后我的 View 不再全屏。

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return self.view.frame.size.height
}

最佳答案

迟到的回答,可能对其他人有帮助。用于 TableViewcell 的全屏分页。请按照以下步骤操作。

(Consider as Without navigation bar)

  1. TableView 约束应该与 superview(不是 safeArea)一起使用,并且常量为 0。 enter image description here
  • 如下所示配置您的 Tableview。

    覆盖 func viewDidLoad() {

     super.viewDidLoad()
    configureTableView()

    }

    私有(private)函数configureTableView() {

         tableView.rowHeight = UIScreen.main.bounds.height
    tableView.estimatedRowHeight = UIScreen.main.bounds.height
    tableView.separatorStyle = .none
    tableView.isPagingEnabled = true
    tableView.bounces = false
    tableView.estimatedSectionHeaderHeight = CGFloat.leastNormalMagnitude
    tableView.sectionHeaderHeight = CGFloat.leastNormalMagnitude
    tableView.estimatedSectionFooterHeight = CGFloat.leastNormalMagnitude
    tableView.sectionFooterHeight = CGFloat.leastNormalMagnitude
    tableView.contentInsetAdjustmentBehavior = .never
    tableView.delegate = self
    tableView.dataSource = self
    }
  • 关于ios - swift:如何使用 InfiniteScrolling 设置 UITableViewCell 显示全屏(允许分页),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48637951/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com