2013-12-09 35 views
0

剛開始使用xCode 5 storyboard,並且遇到圖像問題。我有一個視圖控制器,它包含一個滾動視圖>圖像視圖。查看xCode storyboard中的圖像寬度擴展

當圖像加載時,它以全尺寸顯示並展開滾動視圖。我試着改變視圖模式並按照如下所示編程調整它的大小,但它不起作用。任何人都可以解釋一下這個問題嗎?

if(!_curInfo.img) 
    { 
     showActivity(self); 
     dispatch_queue_t aQueue1 = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 
     dispatch_async(aQueue1, ^{ 
      _curInfo.img = getImageFromURL([NSString stringWithFormat:@"%@%@", g_serverUrl, _curInfo.imgPath]); 
      dispatch_async(dispatch_get_main_queue(), ^{ 
       hideActivity(); 
       [_imgCompany setImage:_curInfo.img]; 
      }); 
     }); 
    } 

    _imgCompany.frame = CGRectMake(0,0,320,180); 
    _imgCompany.contentMode=UIViewContentModeScaleAspectFill; 
    _imgCompany.clipsToBounds=YES; 
    [_imgCompany setImage:_curInfo.img]; 

這裏是什麼樣子 enter image description here

+0

我有一個與iOS公平的exp,但我總是有困難混合滾動和自動佈局。禁用自動佈局並嘗試... – amar

+0

嘗試'_imgCompany.clipsToBounds = NO;' – preetam

+0

是否在故事板中打開了自動佈局的主開關? – bilobatum

回答

0

你可以試試:

_imgCompany.autoresizingMask = UIViewAutoresizingNone; 

self.edgesForExtendedLayout=UIRectEdgeNone; 
self.extendedLayoutIncludesOpaqueBars=NO; 
self.automaticallyAdjustsScrollViewInsets=NO; 
+0

感謝您的回覆。我嘗試了兩種選擇,都取得了相同的結果。還有什麼想法? – tomjung

+0

您可以在滾動視圖或文件所有者中設置autoresizingMask使用Autolay標記關閉。 – payal

0

你可能有自動佈局主開關接通。把它關掉。