iOS 使用xib创建cell的两种初始化方式
曾几何时,被自己坑过,为了防止下次继续被自己坑,我决定了!在每个我能看到的地方,都把问题写一遍!!!
方法一:
1
2
3
4
|
第一步: [self.collectionView registerNib:[UINib nibWithNibName:@ "QGLShareBtnCell" bundle:nil] forCellWithReuseIdentifier:@"QGLShareBtnCell”]; 第二步: QGLShareBtnCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@ "QGLShareBtnCell" forIndexPath:indexPath]; |
方法二:
1
2
3
4
|
QGLIMGroupListCell *cell = (QGLIMGroupListCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell= (QGLIMGroupListCell *)[[[NSBundle mainBundle] loadNibNamed:@ "QGLIMGroupListCell" owner:self options:nil] lastObject];
|
just for 10k now
do it
just do it
I believe I can I do ....