2012-07-14 23 views
0

我有一個自定義的UITableViewCell內一個UIImageView,的UIImageView一個自定義的UITableViewCell內 - 總是調整大小的圖像

而且無論我在上面放置其中的圖像,它總是調整大小以適應圖像,而不是其他的方式。

所以如果圖像非常大,它會佔據整個細胞!我有UIImageView設置爲ScaletoFill,我不明白爲什麼會發生這種情況。

編輯:代碼請求..所以我這是怎麼了圖像分配給UIImageView的,其構建的UITableViewCell函數內部..

UIImageView* ivImage = (UIImageView*)[cell ViewwithTag:0]; 
ivImage.image = //Some image I have that's loaded from a URL or from local 

,基本上就是這樣。單元格中的UIImageView在IB中創建爲特定大小。

感謝

Roey

+0

請添加一些代碼。 – Madhumitha 2012-07-14 11:39:46

+1

其實標籤值爲0?如果是,則將其值更改爲0,因爲所有視圖的標記值默認爲0 – 2012-07-14 11:51:10

+0

OMG!你是對的!!雖然我沒有其他標記值爲0,只是將值更改爲4解決了這個問題! – 2012-07-14 14:41:09

回答

-1

你試過設置contentMode到中心???

[cell.imgView setContentMode:UIViewContentModeCenter]; 
+0

此問題沒有回答實際問題。我看到相同的行爲,沒有明確的出路。 – user210504 2014-03-10 14:04:07

相關問題