美文网首页
[完] iOS ➕方法-方法 中的self具体表示什么?

[完] iOS ➕方法-方法 中的self具体表示什么?

作者: 管乐_VICTOR | 来源:发表于2018-07-19 18:51 被阅读8次
//+ 方法
+ (instancetype)cellWithTableView:(UITableView *)tableView {
    static NSString *cellID = @"unlockCellIdentifier";
    id cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    DLog(@"%@>>>%@", self, [self superclass]);
    if (!cell) {
        DLog(@"%@",self);
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    return cell;
}
打印结果:
2018-07-18 14:34:26.964118+0800 bluetoothLock[4786:185390] [文件名:/Users/****/Desktop/iOS/****/****/classes/unlockRecord/view/TGUnlockRecordCell.m]
[函数名:+[TGUnlockRecordCell cellWithTableView:]]
[行号:44] 
TGUnlockRecordCell>>>UITableViewCell
//- 方法
- (instancetype)cellWithTableView:(UITableView *)tableView {
    static NSString *cellID = @"unlockCellIdentifier";
    id cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    DLog(@"%@>>>%@", self, [self superclass]);
    if (!cell) {
        DLog(@"%@",self);
        cell = [self initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    return cell;
}
打印结果:
2018-07-18 14:37:44.904729+0800 bluetoothLock[4851:188018] [文件名:/Users/****/Desktop/iOS/****/****/classes/unlockRecord/view/TGUnlockRecordCell.m]
[函数名:-[TGUnlockRecordCell cellWithTableView:]]
[行号:44] 
<TGUnlockRecordCell: 0x7fb1560b5a00; baseClass = UITableViewCell; frame = (0 0; 320 44); layer = <CALayer: 0x60400042ce00>>>>>UITableViewCell

相关文章

网友评论

      本文标题:[完] iOS ➕方法-方法 中的self具体表示什么?

      本文链接:https://www.haomeiwen.com/subject/rufxmftx.html