gpt4 book ai didi

ios - willDisplay 单元格中的函数也在 View 加载时调用

转载 作者:行者123 更新时间:2023-11-29 05:48:17 28 4
gpt4 key购买 nike

override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {

if userType == "2" {
if (indexPath.section == (page * 10) - 2) && (page > 0) && (pagedone == false){
self.setupInbox(self.appDele!.glat, slng: self.appDele!.glong, animate: false)
if (page >= 1 ) {
page = page + 1
}
}
} else if userType == "1" {
if indexPath.section == 10 {
showAlert()
}
}
}



override func numberOfSections(in tableView: UITableView) -> Int {
return arrayOfRels.count
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
guard let release = arrayOfRels[exist: indexPath.section] else { return 0 }

if release.isAttendingNow == "1" {
return 120.0
}

return 90.0

}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}

override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 5
}

// Make the background color show through
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerView = UIView()
headerView.backgroundColor = UIColor.clear
return headerView
}

showAlert() 函数在 View 加载时也会调​​用。

只有在indexPath.section == 10时才应该调用

我怎样才能让它发挥作用?

最佳答案

如果您的屏幕足够大,可以在 viewDidLoad 之后立即显示第 10 节,那么 showAlter() 将在 viewDidLoad 之后立即调用,假设您的userType1

关于ios - willDisplay 单元格中的函数也在 View 加载时调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55933453/

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