当我在横向启动视图控制器时,单元格位于错误的位置(左侧和右侧的位置不正确),但是在我旋转后,纵向和横向的一切都正常。对此可以做些什么?我尝试使布局无效,调用旋转方法无济于事。
这是我的代码:
设置流布局:
self.flowLayout = [[PSTCollectionViewFlowLayout alloc] init];
self.flowLayout.scrollDirection = PSTCollectionViewScrollDirectionVertical;
self.flowLayout.minimumInteritemSpacing = VERTICAL_ITEM_SPACING;
self.flowLayout.minimumLineSpacing = HORIZONTAL_ITEM_SPACING;
插入方法:
- (UIEdgeInsets)collectionView:(PSTCollectionView *)collectionView
layout:(PSTCollectionViewLayout*)collectionViewLayout
insetForSectionAtIndex:(NSInteger)section {
self.currentOrientation = [UIApplication sharedApplication].statusBarOrientation;
self.insets = UIInterfaceOrientationIsPortrait(self.currentOrientation) ? UIEdgeInsetsMake(0, 72, 24, 72) : UIEdgeInsetsMake(0, 35, 24, 35);
//[self.collectionView.collectionViewLayout invalidateLayout];
return self.insets;
}