2011-08-04 30 views
0

在縱向模式下,我的應用程序具有滾動視圖,該視圖在2x2網格中顯示4個圖像。在橫向模式下,滾動視圖以3x1網格顯示圖像。如何在縱向和橫向視圖中顯示來自相同位置的圖像

我希望能夠旋轉視圖,並從它們位於之前方向的位置查看圖像。

我試圖通過設置偏移量來做到這一點,但它不起作用。有誰能夠幫助我?

回答

1

您需要調整的是網格視圖的框架在此方法中

- (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation) fromInterfaceOrientation duration: (NSTimeInterval) duration { 

     UIInterfaceOrientation myInterface=self.Orientation; 
     if (myInterface == UIInterfaceOrientationLandscapeRight||myInterface == UIInterfaceOrientationLandscapeLeft) { 

//landscape size of the gridView.frame=CGRectMake(0, 0, 480, 320); 
    } 
    else{ 

//portrait size of the gridView.frame=CGRectMake(0, 0, 320, 480); 
    } 
    } 
+0

感謝Sanchit你的答案,但我已經通過這種方式嘗試,但仍無法 –

相關問題