UICollectionView 方向改变事故?

UICollectionView orientation change mishap?

当我的 collection 视图位于底部并且我将其从纵向更改为横向时,单元格会从视图中消失,直到我必须将它们向下拖动,如下所示:

常规纵向视图:

旋转成横向时的视图:

从视图顶部拖动单元格:

我该如何解决这个问题?

-(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);
    }
}