swift – 类型’Int’不符合协议’BooleanType’
发布时间:2020-12-14 04:35:07 所属栏目:百科 来源:网络整理
导读:我对这个陈述做错了什么? currentRow是一个NSIndexPath override func tableView(tableView: UITableView,heightForRowAtIndexPath indexPath: NSIndexPath) - CGFloat { if indexPath.row currentRow?.row == 5 { return 300 } return 70 我得到的错误是:
我对这个陈述做错了什么?
currentRow是一个NSIndexPath override func tableView(tableView: UITableView,heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { if indexPath.row && currentRow?.row == 5 { return 300 } return 70 我得到的错误是:
解决方法
如果要检查,如果currentRow和indexPath都是5,则不能使用if语句.将其更改为:
if indexPath.row == currentRow?.row && currentRow == 5 { 要么: if indexPath.row == 5 && currentRow?.row == 5 { 如果要检查indexPath是否为nil,请检查indexPath是否为0 if indexPath.row != 0 && currentRow?.row == 5 { (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |