我在界面生成器中创建了一个 UICollectionView。我引用了它
@property (strong, nonatomic) IBOutlet UICollectionView *contactList;
在我的 .h 文件和@synthesize 联系人列表中;在我的 .m 文件中。
我尝试使用以下代码在纵向和横向中实现稍微不同的布局:  
- (void) adjustViewsForOrientation:(UIInterfaceOrientation) orientation {
    if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
        UICollectionViewFlowLayout *flow = (UICollectionViewFlowLayout*)contactList.collectionViewLayout;
        flow.sectionInset = UIEdgeInsetsMake(48, 80, 48, 0);
        flow.minimumLineSpacing = 80;
    } else if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
        UICollectionViewFlowLayout *flow = (UICollectionViewFlowLayout*)contactList.collectionViewLayout;
        flow.sectionInset = UIEdgeInsetsMake(48, 64, 48, 0);
        flow.minimumLineSpacing = 64;
    }
}
这工作得很好,但我也想改变大小(横向我每页有一个 2*3 网格,纵向它是一个 3*2 网格)。我尝试像这样设置大小:
CGRect frame = [contactList frame];
frame.size.width = 960;
[contactList setFrame:frame];
但它不会更新。没有错误,但视图没有更新。它只是保持与以前相同的大小。我该怎么做才能更新视图?