Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swift tableview高度自适应时报错 #330

Open
baiRookie opened this issue Jul 18, 2020 · 1 comment
Open

swift tableview高度自适应时报错 #330

baiRookie opened this issue Jul 18, 2020 · 1 comment

Comments

@baiRookie
Copy link

swift使用错误信息。[self.modelCell setValue:model forKey:keyPath] cell添加了@objcMembers model中也添加了@objcMembers 可还是一直报错 请问有办法解决吗

@zyHit-GitHub
Copy link

在模型前面加 @objc

@objc class HMMsgDetailItemModel :NSObject, Codable { xxx }

cell里新增一个model的实例 前面也加上@objc
@objc var model : HMMsgDetailItemModel!{ didSet{ xxx } }

最后计算高度时使用
let height = mainTableView.cellHeight(for: indexPath, model: model, keyPath: "model", cellClass: HMSysNotifyCell.self, contentViewWidth: ScreenWidth)

使用的是swift5.x
其他版本不清楚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants