Dynamic cell width of UICollectionView depending on label width

前端 未结 7 1362
别跟我提以往
别跟我提以往 2020-11-28 02:44

I have a UICollectionView, that loads cells from reusable cell, which contains label. An array provides content for that label. I can resize label width depending on content

7条回答
  •  醉梦人生
    2020-11-28 03:03

    In Swift 3

    let size = (arrayOfStats[indexPath.row] as NSString).size(attributes: nil)
    

提交回复
热议问题