2011-03-26 19 views

回答

12

剛剛創建的UIImageView像這樣:

UIImageView *aImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourImage.png"]]; 

所以ImageView的有圖像的大小。從UIImageView的文檔:

此方法調整接收器的幀以匹配指定圖像的大小。它也默認禁用圖像視圖的用戶交互。

我希望我的回答能幫助你。 :-D

桑德羅

+0

Nice1桑德羅,會嘗試它。 ;) – jarryd 2011-03-26 14:13:17

0

這裏沒有必要,當我們的ImageView

UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]]; 

的ImageView會自動拍攝圖像的尺寸使用圖像設置框的大小。