SDAutoLayout
SDAutoLayout copied to clipboard
swift UItableViewCell自适应高度及Label高度自适应问题
能写个swift版本的案例吗?为什么我引入库实现UITableViewCell中label自适应及cell高自适应时item全部重叠显示呢?将tableview的高度直接写死就不会重叠但信息显示不全
我这里也遇到了同样的问题,我用的是 OC,同样出现重叠 @gsdios @lixiang1994
我也遇到上面的问题,关于sd在swift上的使用还是太少了
同样,计算返回的cell高度是0, @
可以发一下关键代码吗? tableview相关代理和 cell中model处理
同样有问题: cell 和 model类名前都已经添加 @objcMembers了,不然返回高度的代理方法会崩溃 @lixiang1994 @gsdios
代理返回高度:
return tableView.cellHeight(for: indexPath, model: goods, keyPath: "aGoods", cellClass: CustomCell.self, contentViewWidth: SCREEN_WIDTH)
cell中model处理: var aGoods: GoodsModel? {
didSet {
let url = NSURL(string: (aGoods?.img)!)
self.goodsImageView?.sd_setImage(with:url! as URL)
self.nameLabel?.text = aGoods?.name
self.priceLabel?.text = aGoods?.sale_price
// self.contentView.setupAutoHeight(withBottomViewsArray: [goodsImageView!, priceLabel!], bottomMargin: 5)
}
}