![](/img/trans.png)
[英]UIActionSheet Controller crashed on iPad and Works Fine on iPhone
[英]UICollectionView layout crashes on iPad, but works fine on iPhone
UICollection視圖布局在ipad中令人生畏,但可以在iphone上正常工作。 我們是否需要以不同於iPhone的方式管理iPad的UICollection視圖布局?
我的代碼:
-(void)reloadData {
if(collectionData!= nil)
{
collectionData = nil;
}
[self.collectionView reloadData];
}
-(void)setCollectionView {
if(self.collectionView == nil) {
// self.collectionView = (UICollectionView *)[self.view viewWithTag:_wallCollectionView_tag];
self.collectionView.dataSource = self;
self.collectionView.delegate = self;
self.collectionView.userInteractionEnabled = YES;
}
}
`enter code here`- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{printf("\n = %s",__FUNCTION__);
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return [collectionData count];
}
- (CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout*)collectionViewLayout
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
if ( [ [ UIScreen mainScreen ] bounds ].size.width > 320) {
return CGSizeMake(118, 118);
}
return CGSizeMake(100, 100);
}
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 5 beyond bounds [0 .. 4]' ***
這清楚地表明,您正在嘗試訪問超出數組范圍的元素。 下一步檢查:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.