【发布时间】:2015-05-08 12:26:34
【问题描述】:
我的 UICollectionView 出现问题,我的单元格总是以空白/默认状态启动,没有数据。
数据只有在滚动进出视图后才会出现在单元格中。
代码:
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"EquipmentCell";
APInventoryCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
if (!cell) cell = [[APInventoryCollectionViewCell alloc] init];
//set cell data...
cell.label.text = [arrayOfStrings objectAtIndex:indexPath.row];
return cell;
}
【问题讨论】:
-
你的arrayOfStrings在哪里分配和获取数据?
标签: ios objective-c uicollectionview uicollectionviewcell