cell的提前注冊(cè)方法
[self.tableView registerClass:[HMSQDeliveryHeaderCell class] forCellReuseIdentifier:NSStringFromClass([HMSQDeliveryHeaderCell class])];
在tableview的代理方法中使用時(shí)候
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
提前注冊(cè)了cell情況,
//這個(gè)cell返回的不是空值敬辣,可是有值的
HMSQDeliveryHeaderCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([HMSQDeliveryHeaderCell class])];
沒(méi)有提前注冊(cè)cell的情況
//這個(gè)時(shí)候cell返回的空值
HMSQDeliveryHeaderCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([HMSQDeliveryHeaderCell class])];
//這個(gè)可以重寫 initWithStyle:style reuseIdentifier:reuseIdentifier方法雪标,可以自定義舒適化需要的數(shù)據(jù)
if (!cell) {
cell = [[HMSQDeliveryHeaderCell alloc]initWithStyle:UITableViewCellStyleDefault deliveryStyle:self.style reuseIdentifier:NSStringFromClass([HMSQDeliveryHeaderCell class])];
}