方法一:
第一步:
[self.collectionView registerNib:[UINib nibWithNibName:@"xibNamel" bundle:nil] forCellWithReuseIdentifier:@"myCell”];
第二步:
Mycell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"myCell" forIndexPath:indexPath];
方法二:
Mycell *cell = (Mycell *)[tableView dequeueReusableCellWithIdentifier:mycell];
if (cell == nil) {
cell= (mycell *)[[[NSBundle mainBundle] loadNibNamed:@"xibName" owner:self options:nil] lastObject];
}
前提:xib要先设置identify !!!
第一步:
[self.collectionView registerNib:[UINib nibWithNibName:@"xibNamel" bundle:nil] forCellWithReuseIdentifier:@"myCell”];
第二步:
Mycell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"myCell" forIndexPath:indexPath];
方法二:
Mycell *cell = (Mycell *)[tableView dequeueReusableCellWithIdentifier:mycell];
if (cell == nil) {
cell= (mycell *)[[[NSBundle mainBundle] loadNibNamed:@"xibName" owner:self options:nil] lastObject];
}
前提:xib要先设置identify !!!