【发布时间】:2015-06-12 16:43:16
【问题描述】:
我是 iOS 编程新手,希望您能帮助我。
我得到一个
'NSInvalidArgumentException'
当尝试将 UICollectionViewController 添加到我的 UITabbarController..
'UICollectionView 必须用非零布局参数初始化'
问题是我确实使用 FlowLayout 初始化了我的 CollectionView...这里是 MatchesCell 是我的 UICollectionViewCell 实现的代码
[self.collectionView registerClass:[MatchesCell class] forCellWithReuseIdentifier:@"MatchesCell"];
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
[flowLayout setItemSize:CGSizeMake(200, 140)];
[flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
[self.collectionView initWithFrame:[self.tabBarController.view frame] collectionViewLayout:flowLayout];`
我还尝试使用 [[UIScreen mainScreen] bounds] 或我手动创建的 CGRect 调用 initWithFrame,但也没有用...请帮助!
提前致谢!
【问题讨论】:
-
如何创建您的
UICollectionViewController?
标签: ios uicollectionview uitabbarcontroller collectionview