사용자 지정 CollectionView 셀로 사용자 지정 컬렉션보기를 구현 중입니다.사용자 지정 CollectionViewCell 속성이 없음
다음은 CollectionView를 구현 한 것입니다.
- (void)setUpCollectionView{
[self.view setNeedsLayout];
[self.view layoutIfNeeded];
[self.vwCarCollection setDataSource:self];
[self.vwCarCollection setDelegate:self];
[self.vwCarCollection registerClass:[FindMyCarCell class] forCellWithReuseIdentifier:@"FindMyCarCell"];
[self.vwCarCollection setBackgroundColor:[UIColor redColor]];
[self.vwCarCollection reloadData];
[self.vwCarCollection reloadInputViews];
}
"ViewDidLoad"에서이 함수를 호출했습니다.
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
FindMyCarCell *cell = (FindMyCarCell *)[self.vwCarCollection dequeueReusableCellWithReuseIdentifier:@"FindMyCarCell" forIndexPath:indexPath];
cell.vwImgMain.image = [UIImage imageNamed:@"sample_car"];
cell.lblCarNo.text = @"GH2334343";
return cell;
}
내 코드를 디버깅, 세포 인스턴스가 여기
이 UICollectionViewDataSource 내 구현이<FindMyCarCell: 0x78645b30; baseClass = UICollectionViewCell; frame = (302 50; 221 180); layer = <CALayer: 0x786a07a0>>
같은 존재하지만 내 사용자 지정 셀의 이미지 뷰를 업데이트하려고 할 때, 그것을 그냥 내 이미지보기가 없다는 것을 반환합니다. 내 구현이 잘못되었습니다. 누구든지 나를 제안 할 수 있을까? 감사.
FindMyCarCell * cell = (FindMyCarCell *) [self.vwCarCollection dequeueReusableCellWithReuseIdentifier : @ "FindMyCarCell"forIndexPath : indexPath]; self.vwCarCollection을 collectionView로 대체 한 다음 – ajjjjjjjj
'FindMyCarCell'에'vwImgMain'을 만드는 방법을 보여줄 수 있습니까? – nynohu
듣기 좋은 튜토리얼이 있지만 신속하지만 개념은 obj-c와 유사합니다. http://randexdev.com/2014/08/uicollectionviewcell/ –