2015-08-15 63 views
1

我想要更改UITableViewCell(cell.imageView ...)中默認imageView的位置。是否有可能這樣做,還是我必須創建一個新的?更改imageView在UITableViewCell中的位置

+0

我想這樣做是定製的UITableViewCell的最佳途徑。 – Sebastian

+0

好的。我在UITableViewCell子類中創建了一個imageView。我如何將它添加到自定義的UITableViewCell? – paro

回答

0

可以以這種方式添加新的圖像視:

let iconImageView = UIImageView() 
    iconImageView.frame = CGRectMake(10, 10, 50, 50) 
    iconImageView.image = UIImage(named: "image_name") 

    // you have to add the imageview to the content view of the cell 
    contentView.addSubview(iconImageView) 
+0

所有在'init(style:UITableViewCellStyle,reuseIdentifier:String?)'函數? – paro

+0

是的。任何初始化應該工作。 – Darko

+0

好的。我可以控制在哪個單元格中設置圖像嗎?我不喜歡把它放在所有的單元格中。 – paro

相關問題