Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
90 lines (74 loc) · 3.16 KB

File metadata and controls

executable file
·
90 lines (74 loc) · 3.16 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
// ProjectCodeListCell.m
// Coding_iOS
//
// Created by 王 原闯 on 14/10/29.
// Copyright (c) 2014年 Coding. All rights reserved.
//
#define kCode_IconViewWidth 20.0
#define kCode_ContentLeftPading (kPaddingLeftWidth+kCode_IconViewWidth+10)
#import "ProjectCodeListCell.h"
@interface ProjectCodeListCell ()
@property (strong, nonatomic) UIImageView *leftIconView, *commitTimeIcon;
@property (strong, nonatomic) UILabel *fileNameL, *commitorNameL, *commitTimeL;
@end
@implementation ProjectCodeListCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
// Initialization code
if (!_leftIconView) {
_leftIconView = [[UIImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, ([self.class cellHeight] - kCode_IconViewWidth)/2, kCode_IconViewWidth, kCode_IconViewWidth)];
[self.contentView addSubview:_leftIconView];
}
if (!_fileNameL) {
_fileNameL = [[UILabel alloc] initWithFrame:CGRectMake(kCode_ContentLeftPading, 10, kScreen_Width-kCode_ContentLeftPading-30, 20)];
_fileNameL.font = [UIFont systemFontOfSize:14];
_fileNameL.textColor = kColor222;
[self.contentView addSubview:_fileNameL];
}
if (!_commitorNameL) {
_commitorNameL = [UILabel labelWithSystemFontSize:12 textColorHexString:@"0x222222"];
[self.contentView addSubview:_commitorNameL];
}
if (!_commitTimeIcon) {
_commitTimeIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"time_clock_icon"]];
[self.contentView addSubview:_commitTimeIcon];
}
if (!_commitTimeL) {
_commitTimeL = [UILabel labelWithSystemFontSize:12 textColorHexString:@"0x999999"];
[self.contentView addSubview:_commitTimeL];
}
[_commitorNameL mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_fileNameL);
make.bottom.equalTo(self.contentView).offset(-10);
}];
[@[_commitTimeIcon, _commitTimeL] mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(_commitorNameL);
}];
[_commitTimeIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_commitorNameL.mas_right).offset(15);
make.right.equalTo(_commitTimeL.mas_left).offset(-5);
}];
}
return self;
}
- (void)layoutSubviews{
[super layoutSubviews];
if (!_file) {
return;
}
self.leftIconView.image = [UIImage imageNamed:[NSString stringWithFormat:@"icon_code_%@", _file.mode]];
if (!self.leftIconView.image) {
self.leftIconView.image = [UIImage imageNamed:@"icon_code_file"];
}
self.fileNameL.text = _file.name;
self.commitorNameL.text = _file.info.lastCommitter.name ?: @"...";
self.commitTimeL.text = _file.info.lastCommitDate? [_file.info.lastCommitDate stringTimesAgo]: @"...";
}
+ (CGFloat)cellHeight{
return 60.0;
}
@end
Morty Proxy This is a proxified and sanitized view of the page, visit original site.