我有,我想用UITableViewCellStyleSubtitle
風格,提供了一個UIImageView
,以及兩行文字,以及一個可選的附件視圖在UITableViewCell
來顯示圖像。的iOS SDK UIViewContentModeScaleAspectFit與UIViewContentModeScaleAspectFill
但是,當我將UIImageView
的內容模式設置爲UIViewContentModeScaleAspectFit
或UIViewContentModeScaleAspectFill
中的任何一個時,似乎沒有區別。這兩種內容模式都只是顯示整個圖像,將文本向右移動以爲圖像騰出空間。
有沒有人有任何這些實際上如何不同的例子?該文檔說:
UIViewContentModeScaleAspectFit:
Scales the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the view’s bounds is transparent.
UIViewContentModeScaleAspectFill:
Scales the content to fill the size of the view. Some portion of the content may be clipped to fill the view’s bounds.
但是,這些內容模式似乎不像廣告一樣行事。
編輯︰我正在運行SDK iOS 4.
我能想到的唯一的事情是,也許UITableViewCell與UITableViewCellStyleSubtitle覆蓋這些內容模式,以自動調整圖像視圖的大小,以插入圖像的大小。這通過實踐取得的成果有所幫助。 – Dalmazio 2010-07-10 23:14:51
一般來說,我發現當UIKit自動生成一個視圖應該看起來的樣子時,它看起來就像需要你的參數並將它們用作指導。相反,它會經歷一些奇怪的專有代碼,有時會給你奇怪的輸出。 有時候,如果沒有它們提供的默認值並從頭開始創建UITableViewCell,會更容易。 – 2010-07-26 19:54:05