在UIViewController里定义了一个UICollectionView,注册cell
UIViewController.h里面
@property (weak, nonatomic) IBOutlet UICollectionView *pictureCollection;
UIViewController.m里面
[self.pictureCollection registerClass:[CAPictureCell class] forCellWithReuseIdentifier:@"capicture"];
加载cell的代码
-(UICollectionViewCell )collectionView:(UICollectionView )collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
CAPictureCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"capicture" forIndexPath:indexPath];
if (cell==nil) {
cell=[[CAPictureCell alloc]init];
}
NSDictionary *dic = [[NSDictionary alloc] init];
[cell setInfo:dic];
return cell;
}
CAPictureCell.m文件里面
-
(void)setInfo:(NSDictionary*)d{
self.backgroundColor = [UIColor redColor]; [self.CAPicture setImage:[UIImage imageNamed:@"logoGrey.png"]]; self.CALabel.text = @"222";
}
想要实现cell
目前只有backgroundColor出来了
求助。
加断点,看setInfo有么有走到