コレクション ビューのコードは次のとおりです。
- (void)viewDidLoad
{
[super viewDidLoad];
...
[_teamsCollection registerClass:[MWTeamCollectionCell class] forCellWithReuseIdentifier:@"Cell"];
}
#pragma mark data source and delegate methods of collection view
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return 10;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";
MWTeamCollectionCell *cell = [_teamsCollection dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell == nil) {
cell = (MWTeamCollectionCell*)[[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.teamName.text = @"team name";
return cell;
}
行をデバッグするとreturn cell;
、適切なログが取得されますが、セルが表示されません。
(gdb) po cell
<MWTeamCollectionCell: 0x72aff80; baseClass = UICollectionViewCell; frame = (0 0; 50 50); layer = <CALayer: 0x72b0090>>
(gdb) po cell
<MWTeamCollectionCell: 0x72b08e0; baseClass = UICollectionViewCell; frame = (67.5 0; 50 50); layer = <CALayer: 0x72b0970>>
(gdb) po cell
<MWTeamCollectionCell: 0x8aad380; baseClass = UICollectionViewCell; frame = (135 0; 50 50); layer = <CALayer: 0x8a72d20>>