Skip to content

Commit b538f43

Browse files
committed
UI调整
1 parent 448a9cc commit b538f43

3 files changed

Lines changed: 32 additions & 24 deletions

File tree

Coding_iOS/Views/Cell/ProjectDescriptionCell.m

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,28 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
3333
_proDesL.textColor = [UIColor colorWithHexString:@"0x222222"];
3434
[self.contentView addSubview:_proDesL];
3535
}
36-
NSInteger gitBtnNum = 3;
37-
CGFloat whiteSpace = 7.0;
38-
CGFloat btnWidth = (kProjectDescriptionCell_ContentWidth - whiteSpace *2) /3;
39-
_gitButtons = [[NSMutableArray alloc] initWithCapacity:gitBtnNum];
40-
41-
for (int i = 0; i < gitBtnNum; i++) {
42-
EaseGitButton *gitBtn = [EaseGitButton gitButtonWithFrame:CGRectMake(kPaddingLeftWidth + i *(btnWidth +whiteSpace),0, btnWidth, kScaleFrom_iPhone5_Desgin(33)) type:i];
43-
44-
[gitBtn bk_addEventHandler:^(EaseGitButton *sender) {
45-
if (sender.type == EaseGitButtonTypeStar
46-
|| sender.type == EaseGitButtonTypeWatch) {
47-
gitBtn.checked = !gitBtn.checked;
48-
gitBtn.userNum += gitBtn.checked? 1: -1;
49-
}
50-
if (self.gitButtonClickedBlock) {
51-
self.gitButtonClickedBlock(i);
52-
}
53-
} forControlEvents:UIControlEventTouchUpInside];
54-
[self.contentView addSubview:gitBtn];
55-
[_gitButtons addObject:gitBtn];
36+
if (!_gitButtons) {
37+
NSInteger gitBtnNum = 3;
38+
CGFloat whiteSpace = 7.0;
39+
CGFloat btnWidth = (kProjectDescriptionCell_ContentWidth - whiteSpace *2) /3;
40+
_gitButtons = [[NSMutableArray alloc] initWithCapacity:gitBtnNum];
41+
42+
for (int i = 0; i < gitBtnNum; i++) {
43+
EaseGitButton *gitBtn = [EaseGitButton gitButtonWithFrame:CGRectMake(kPaddingLeftWidth + i *(btnWidth +whiteSpace),0, btnWidth, kScaleFrom_iPhone5_Desgin(30)) type:i];
44+
45+
[gitBtn bk_addEventHandler:^(EaseGitButton *sender) {
46+
if (sender.type == EaseGitButtonTypeStar
47+
|| sender.type == EaseGitButtonTypeWatch) {
48+
gitBtn.checked = !gitBtn.checked;
49+
gitBtn.userNum += gitBtn.checked? 1: -1;
50+
}
51+
if (self.gitButtonClickedBlock) {
52+
self.gitButtonClickedBlock(i);
53+
}
54+
} forControlEvents:UIControlEventTouchUpInside];
55+
[self.contentView addSubview:gitBtn];
56+
[_gitButtons addObject:gitBtn];
57+
}
5658
}
5759
}
5860
return self;
@@ -93,8 +95,13 @@ - (void)layoutSubviews{
9395
[super layoutSubviews];
9496
CGFloat desHeight = [_curProject.description_mine getSizeWithFont:kProjectDescriptionCell_Font constrainedToSize:CGSizeMake(kProjectDescriptionCell_ContentWidth, CGFLOAT_MAX)].height;
9597
[_proDesL setFrame:CGRectMake(kPaddingLeftWidth, kPaddingLeftWidth, kProjectDescriptionCell_ContentWidth, desHeight)];
98+
99+
CGFloat gitBtnY = kPaddingLeftWidth*2 +desHeight;
96100
[_gitButtons enumerateObjectsUsingBlock:^(EaseGitButton *obj, NSUInteger idx, BOOL *stop) {
97-
[obj setY:kPaddingLeftWidth*2 +desHeight];
101+
CGFloat diffY = ABS(CGRectGetMinY(obj.frame) - gitBtnY);
102+
if (diffY > 1) {
103+
[obj setY:gitBtnY];
104+
}
98105
}];
99106
}
100107

Coding_iOS/Views/Cell/UserInfoTextCell.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
1919
if (self) {
2020
// Initialization code
2121
if (!_titleL) {
22-
_titleL = [[UILabel alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, 12, kScreen_Width/4, 20)];
22+
_titleL = [[UILabel alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, 12, 80, 20)];
2323
_titleL.textAlignment = NSTextAlignmentLeft;
2424
_titleL.font = [UIFont systemFontOfSize:15];
2525
_titleL.textColor = [UIColor colorWithHexString:@"0x888888"];

Coding_iOS/Views/EaseUserHeaderView.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ - (void)configUI{
118118

119119
if (!_userIconView) {
120120
_userIconView = [[UITapImageView alloc] init];
121+
_userIconView.backgroundColor = kColorTableBG;
121122
[_userIconView addTapBlock:^(id obj) {
122123
if (weakSelf.userIconClicked) {
123124
weakSelf.userIconClicked();
@@ -166,12 +167,12 @@ - (void)configUI{
166167
}];
167168

168169
[_userLabel mas_makeConstraints:^(MASConstraintMaker *make) {
169-
make.bottom.equalTo(_followBtn.mas_top).offset(kScaleFrom_iPhone5_Desgin(-15));
170+
make.bottom.equalTo(_followBtn.mas_top).offset(kScaleFrom_iPhone5_Desgin(-25));
170171
make.height.mas_equalTo(kScaleFrom_iPhone5_Desgin(20));
171172
}];
172173
}else{
173174
[_userLabel mas_makeConstraints:^(MASConstraintMaker *make) {
174-
make.bottom.equalTo(_fansCountBtn.mas_top).offset(kScaleFrom_iPhone5_Desgin(-15));
175+
make.bottom.equalTo(_fansCountBtn.mas_top).offset(kScaleFrom_iPhone5_Desgin(-20));
175176
make.height.mas_equalTo(kScaleFrom_iPhone5_Desgin(20));
176177
}];
177178
}

0 commit comments

Comments
 (0)