2021-07-14 19:54:34 +08:00
|
|
|
/*
|
|
|
|
* Copyright [2019] [Doric.Pub]
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
//
|
|
|
|
// DoricShowNodeTreeViewController.m
|
|
|
|
// Doric
|
|
|
|
//
|
|
|
|
// Created by jingpeng.wang on 2021/7/12.
|
|
|
|
//
|
|
|
|
#import "DoricShowNodeTreeViewCell.h"
|
|
|
|
|
|
|
|
#import <DoricCore/Doric.h>
|
|
|
|
|
|
|
|
@implementation DoricShowNodeTreeViewCell
|
|
|
|
|
|
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
|
|
|
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
|
|
|
|
|
|
|
if (self) {
|
2021-07-15 14:51:19 +08:00
|
|
|
NSString *base64 = @"iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAaZUlEQVR4Xu2dCbAuRXXH/2QRylLRQjASA0SNIlIBoyBuoBIXiCtuqEHEBQwaDUZcEncsIRjXiCaKW3AXRaMJYsAoMQmKRjFPVCIquAWEMqhlglVUUr/7eh7f++63nNPTPd98M+dUTd377jt9uvv0/Ke3s+ygoJoauL0knr0l7SLpRpJuPPVz+m+052eSfj7xc/L35v+ulvQNSd9MT81+jFb2DqPtebmO3zyBYBIMze/lalkuqQHKJGj421XLiwbHPA0EQPzvxl6S7i3pkPSTf/eZv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2DLCZWVLpzet0wDhPwenqUSvExlreKfWls/ML4ASP0BJXksy6zfdFSFTdd3G/5pgBAlkWiJVmJj7rm1tModA18ApJtR9masIv3ftllnGiDe/cdjnIDqRiXrUUsApJtxIp4v3rBWwnr92HkziNf2ai9Jl1lrDr7tNBAA6eaFuI2kbzmqwrJ3W8TQyRnEu/9YaOTlaNBYWQMg3Y38FmeY3G37kEmAsFzynEa9qUU20u5U09+aAiDdjY3XrvAYSZTZLnzoWyQt9K6a6k92xOzu9NLrmgIg3Q3P0yS92VEd4AAk2wHkUknkhLMSEe0usTIH3yYNBEC6eym8nrEc87LM2gYQwjj+2NFefD88Z8sO0aNhDYB0O9T/5Yx6sivhcps9iDf41pkZmaW6VUf/awuAdDtGXrOTjaCHDUC8MU7JiY6DfFC+BgIg+brLKXmiJIIZWmkjpnQDEG9kOleEbGuLRsYXAOl2wL2ZCTYigzYA8QYAxuPQY7PVrSrWo7YASLfjRBLQTR6DC5
|
|
|
|
|
2021-07-14 19:54:34 +08:00
|
|
|
self.nodeIcon = [[UIImageView new] also:^(UIImageView *it) {
|
|
|
|
it.width = 20;
|
|
|
|
it.height = 20;
|
2021-07-15 14:51:19 +08:00
|
|
|
it.left = 5;
|
2021-07-14 19:54:34 +08:00
|
|
|
it.contentMode = UIViewContentModeScaleToFill;
|
|
|
|
[self.contentView addSubview:it];
|
2021-07-15 14:51:19 +08:00
|
|
|
|
|
|
|
NSData *imageData = [[NSData alloc] initWithBase64EncodedString:base64
|
|
|
|
options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
|
|
|
it.image = [UIImage imageWithData:imageData];
|
|
|
|
|
|
|
|
it.userInteractionEnabled = YES;
|
|
|
|
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClick:)];
|
|
|
|
[it addGestureRecognizer:tapGestureRecognizer];
|
2021-07-14 19:54:34 +08:00
|
|
|
}];
|
|
|
|
|
2021-07-15 14:51:19 +08:00
|
|
|
self.nodeNameLabel = [[UILabel new] also:^(UILabel *it) {
|
2021-07-14 19:54:34 +08:00
|
|
|
it.contentMode = UIViewContentModeScaleToFill;
|
|
|
|
it.left = 30;
|
2021-07-15 14:51:19 +08:00
|
|
|
UIFont *font = it.font;
|
|
|
|
if (font) {
|
|
|
|
it.font = [it.font fontWithSize:12];
|
|
|
|
} else {
|
|
|
|
it.font = [UIFont systemFontOfSize:12];
|
|
|
|
}
|
2021-07-14 19:54:34 +08:00
|
|
|
[self.contentView addSubview:it];
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)layoutSubviews {
|
|
|
|
[super layoutSubviews];
|
|
|
|
|
|
|
|
self.nodeIcon.centerY = self.contentView.height / 2;
|
|
|
|
self.nodeNameLabel.centerY = self.contentView.height / 2;
|
|
|
|
}
|
|
|
|
|
2021-07-15 14:51:19 +08:00
|
|
|
- (void)onClick:(UITapGestureRecognizer *)recognizer {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-07-14 19:54:34 +08:00
|
|
|
@end
|