我有一个 custom UICollectionViewCell
,我通过像这样注册它从我的视图控制器中取出它
[self.calendarView registerNib:[UINib nibWithNibName:NSStringFromClass([DayCell class]) bundle:nil] forCellWithReuseIdentifier:dayCell];
然后像这样出队
cell = [collectionView dequeueReusableCellWithReuseIdentifier:dayCell forIndexPath:indexPath];
我的问题是,哪种UICollectionViewCell
init 方法可以让我访问单元格的reuseIdentifier
?awakeFromNib
和方法都initWithCoder:
被调用,但是,都记录(null)
.self.reuseIdentifier
这是一个问题,因为我想使用相同的UICollectionViewCell
类但使用不同reuseIdentifier
的 s 来实现外观略有不同的单元格,并且我想在初始化时执行一次样式设置。例如,一个带有dayCellDisabled
reuseIdentifier
较浅颜色的标签的单元格。