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

//+ 方法
+ (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


 

猜你喜欢

转载自blog.csdn.net/JWheat/article/details/81120852