2013-05-17 31 views
0

我已經編寫了一個用於縮放的代碼UIImageview。我的問題是imageview在iPhone 4中正確縮放,但不是在iphone4s中。UIViewContentModeScaleAspectFilter UIimageview在iphone 4中正常工作,但不在iphone4s中

我的代碼如下:

UIImageView *imgBG1 = [[UIImageView alloc]init]; 
[imgBG1 setImageWithURL:url placeholderImage:nil]; 
     imgBG1.contentMode = UIViewContentModeScaleAspectFit; 
     imgBG1.autoresizingMask = (UIViewAutoresizingFlexibleWidth | 
             UIViewAutoresizingFlexibleHeight); 
[scrlView addSubview:imgBG1]; 

請注意,我從攝像頭捕獲的圖像和分配該圖像imgBG1。

任何幫助,將不勝感激。

+0

嘗試不同的autoResizing屬性。它應該工作。什麼是操作系統版本? –

+0

該版本是6.1.3 – NiravPatel

回答

0
[imgBG1 setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; 

還要確保superview已將autoresizesSubviews設置爲YES。

告訴我它的工作與否:)

+0

已經寫好這條線哥們..沒有工作.... – NiravPatel

相關問題