gpt4 book ai didi

ios - 为什么我得到多行打印结果 - Xcode 控制台

转载 作者:行者123 更新时间:2023-11-29 00:58:15 26 4
gpt4 key购买 nike

我有一些代码可以“重新调整”各种表格 View 单元格的高度。

我很困惑为什么我在 Xcode 控制台中收到多个打印语句,如下所示:

enter image description here

我的代码:

override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {

if (!defaults.boolForKey("purchased")) {

print("show banner, reduce filmstrip");
var height: CGFloat = 0
switch indexPath.row {
case 0: height = 4
case 2: height = 70
default: height = tableView.frame.size.height - 219
}
return height }

else {
print("hide banner, increase filmstrip");
var height: CGFloat = 0
switch indexPath.row {
case 0: height = 4
case 2: height = 70
default: height = tableView.frame.size.height - 169
}
return height
}
}

如何修改 print("") 语句以在 XCode 控制台中仅实现一 (1) 打印行输出?

最佳答案

方法 heightForRowAtIndexPath 被调用的行数与表中的行数相同(您在 numberOfRowsInSection 中返回的行数,每次使用不同的 indexPath,可能在您为键“已购买”保存值之前

关于ios - 为什么我得到多行打印结果 - Xcode 控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37363751/

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