2015-08-19 178 views
0

當我收藏的觀點是在底部,我改變它從縱向到橫向,細胞消失了看法,直到我把他們拖下水,就像這樣:UICollectionView方向改變了嗎?

REGULAR縱向視圖:

enter image description here

視圖時,旋轉到橫向:

enter image description here

拖動單元格從俯視圖:

enter image description here

我該如何解決這個問題?

+0

您需要正確設置框架。 –

+0

究竟哪個框架? @AnkitKargathra –

回答

2
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
              duration:(NSTimeInterval)duration 
{ 
    if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) 
    { 
     self.collectionViewObj.frame = CGRectMake(0, 0, 568, 320); 
    } 
    else 
    { 
     self.collectionViewObj.frame = CGRectMake(0, 0, 320, 568); 
    } 
} 
+0

在執行該方法並運行應用程序後,即使在旋轉到風景之後,初始縱向視圖也如預期的那樣修復了問題。但是,當我旋轉回肖像時,整個視圖會變形,並且在調試器中出現以下錯誤:「快照未渲染的視圖會導致空快照。確保您的視圖至少在屏幕更新後的快照或快照之前呈現一次 –