3
從圖像中檢測到的尺寸如何,然後使用該尺寸創建UIImageView,完全適合內部圖像?使用圖像的確切尺寸創建UIImageVIew
從圖像中檢測到的尺寸如何,然後使用該尺寸創建UIImageView,完全適合內部圖像?使用圖像的確切尺寸創建UIImageVIew
剛剛創建的UIImageView像這樣:
UIImageView *aImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourImage.png"]];
所以ImageView的有圖像的大小。從UIImageView的文檔:
此方法調整接收器的幀以匹配指定圖像的大小。它也默認禁用圖像視圖的用戶交互。
我希望我的回答能幫助你。 :-D
桑德羅
這裏沒有必要,當我們的ImageView
UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]];
的ImageView會自動拍攝圖像的尺寸使用圖像設置框的大小。
Nice1桑德羅,會嘗試它。 ;) – jarryd 2011-03-26 14:13:17