1
我在UITableView單元格中有一個圖像,但對於某些單元格,我不想顯示圖像,因此我決定將圖像高度大小設置爲零(您知道我不能使用Hidden = true)因爲剩餘的空白空間。如何在Swift中調整UIImageView的大小
所以,我嘗試了每一件事,但我無法調整圖像大小,這裏是我的代碼,那麼如何調整大小?
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
那麼,應該怎麼辦?
這個單元格是如何實現的?是否使用了自動佈局? – Kirsteins 2014-10-17 11:37:35
@Kirsteins是的,我也使用了一些限制。 – 2014-10-17 11:41:11
cell!.imageImage.layer.frame = CGRectMake(0,0,cell.frame.width - 你的圖像寬度,cell.frame.height - 你的圖像高度)試試這個.. – 2014-10-17 11:58:42