[英]How to resize UIImageView in Swift
我的UITableView單元格中有一個圖像,但是對於某些單元格,我不想顯示圖像,因此由於保留了空白,我決定將圖像高度大小設置為零(您知道我不能使用Hidden = true)。
因此,我嘗試了所有操作,但是無法調整圖像大小,這是我的代碼,那么如何調整大小?
cell!.imageImage.layer.frame = CGRectMake(0, 0, 0, 0)
cell!.imageImage.layer.masksToBounds = true
我也嘗試過:
cell!.imageImage.frame = CGRectMake(0, 0, 0, 0)
cell!.imageImage.layer.masksToBounds = true
所以我該怎么做 ?
如果將默認的UITableViewCell
與UITableViewCellStyleDefault
,則必須UITableViewCell
子類並實現layoutSubviews
方法,並在那里設置圖像的框架。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.