UICollectionViewCellをサブクラス化しました-
@interface ListCell : UICollectionViewCell
@property(nonatomic,strong) IBOutlet UILabel *lblAppName;
@end
同じためにxibを作成し、すべてのIBOutletコレクションを作成し、XIBのクラスを設定しました。コレクションビューデリゲートメソッドでこのセルを使用しているときに、ラベルインスタンスにアクセスしようとするとnill値を取得します。
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {
ListCell *cell = (ListCell *)[cv dequeueReusableCellWithReuseIdentifier:@"ListCell" forIndexPath:indexPath];
AppDetails *temp=[arrApplist objectAtIndex:indexPath.item];
cell.lblAppName.text=temp.strName;
return cell;
}
セルをコレクションビューに登録しました:
[collectionView registerClass:[ListCell class] forCellWithReuseIdentifier:@"ListCell"];
私が見逃しているかもしれない何か他のものはありますか?前もって感謝します。