-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathLocalFolderCell.m
59 lines (54 loc) · 2.17 KB
/
LocalFolderCell.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// LocalFolderCell.m
// Coding_iOS
//
// Created by Ease on 15/9/22.
// Copyright © 2015年 Coding. All rights reserved.
//
#import "LocalFolderCell.h"
@interface LocalFolderCell ()
@property (strong, nonatomic) UIImageView *iconView;
@property (strong, nonatomic) UILabel *nameLabel;
@end
@implementation LocalFolderCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
// Initialization code
CGFloat icon_width = 45.0;
if (!_iconView) {
_iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_file_folder_normal"]];
[self.contentView addSubview:_iconView];
}
if (!_nameLabel) {
_nameLabel = [UILabel new];
_nameLabel.textColor = kColor222;
_nameLabel.font = [UIFont systemFontOfSize:16];
[self.contentView addSubview:_nameLabel];
}
[_iconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(kPaddingLeftWidth);
make.size.mas_equalTo(CGSizeMake(icon_width, icon_width));
make.centerY.equalTo(self.contentView);
}];
[_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_iconView.mas_right).offset(20);
make.right.equalTo(self.contentView);
make.centerY.equalTo(self.contentView);
make.height.mas_equalTo(30);
}];
NSMutableArray *rightUtilityButtons = [NSMutableArray new];
[rightUtilityButtons sw_addUtilityButtonWithColor:[UIColor colorWithHexString:@"0xF66262"] icon:[UIImage imageNamed:@"icon_file_cell_delete"]];
[self setRightUtilityButtons:rightUtilityButtons WithButtonWidth:[LocalFolderCell cellHeight]];
}
return self;
}
- (void)setProjectName:(NSString *)name fileCount:(NSInteger)fileCount{
_nameLabel.text = [NSString stringWithFormat:@"%@(%ld)", name, (long)fileCount];
}
+ (CGFloat)cellHeight{
return 75.0;
}
@end