Skip to content

Commit 789de83

Browse files
committed
换了好多好多好多图
1 parent ed31d6e commit 789de83

File tree

44 files changed

+114
-25
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+114
-25
lines changed

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 72 additions & 0 deletions
Large diffs are not rendered by default.
195 Bytes
663 Bytes
204 Bytes
661 Bytes

Coding_iOS/Views/Cell/LeftImage_LRTextCell.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
2525
// Initialization code
2626
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
2727
if (!_iconView) {
28-
_iconView = [[UIImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, ([LeftImage_LRTextCell cellHeight] - 28) / 2, 28, 28)];
28+
_iconView = [[UIImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, ([LeftImage_LRTextCell cellHeight] - 33) / 2, 33, 33)];
2929
_iconView.contentMode = UIViewContentModeCenter;
3030
[self.contentView addSubview:_iconView];
3131
}

Coding_iOS/Views/Cell/TaskActivityCell.m

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
// Copyright (c) 2015年 Coding. All rights reserved.
77
//
88

9-
#define kTaskActivityCell_LeftContentPading (kPaddingLeftWidth + 40)
9+
#define kTaskActivityCell_BorderWidth 2.0
10+
#define kTaskActivityCell_IconWidth 33.0
11+
#define kTaskActivityCell_LeftContentPading (kPaddingLeftWidth + kTaskActivityCell_IconWidth + 15)
1012
#define kTaskActivityCell_ContentWidth (kScreen_Width - kTaskActivityCell_LeftContentPading - kPaddingLeftWidth)
1113

1214
#import "TaskActivityCell.h"
@@ -31,8 +33,8 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
3133
[self.contentView addSubview:_timeLineView];
3234
}
3335
if (!_tipIconView) {
34-
CGFloat borderWidth = 2;
35-
_tipIconView = [[UIImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth - borderWidth, 10, 28 + 2*borderWidth, 28 + 2*borderWidth)];
36+
CGFloat borderWidth = kTaskActivityCell_BorderWidth;
37+
_tipIconView = [[UIImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth - borderWidth, 6, kTaskActivityCell_IconWidth + 2*borderWidth, kTaskActivityCell_IconWidth + 2*borderWidth)];
3638
_tipIconView.contentMode = UIViewContentModeCenter;
3739

3840
_tipIconView.layer.masksToBounds = YES;
@@ -41,11 +43,21 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
4143
_tipIconView.layer.borderColor = kColorTableBG.CGColor;
4244

4345
[self.contentView addSubview:_tipIconView];
46+
[_tipIconView mas_makeConstraints:^(MASConstraintMaker *make) {
47+
make.size.mas_equalTo(CGSizeMake(kTaskActivityCell_IconWidth + 2*borderWidth, kTaskActivityCell_IconWidth + 2*borderWidth));
48+
make.left.equalTo(self.contentView).offset(kPaddingLeftWidth - borderWidth);
49+
make.centerY.equalTo(self.contentView);
50+
}];
4451
}
4552
if (!_contentLabel) {
4653
_contentLabel = [[UITTTAttributedLabel alloc] initWithFrame:CGRectMake(kTaskActivityCell_LeftContentPading, 13, kTaskActivityCell_ContentWidth, 15)];
4754
_contentLabel.numberOfLines = 0;
4855
[self.contentView addSubview:_contentLabel];
56+
[_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
57+
make.left.equalTo(self.contentView).offset(kTaskActivityCell_LeftContentPading);
58+
make.centerY.equalTo(self.contentView);
59+
make.width.mas_equalTo(kTaskActivityCell_ContentWidth);
60+
}];
4961
}
5062
}
5163
return self;
@@ -67,8 +79,8 @@ - (void)setCurActivity:(ProjectActivity *)curActivity{
6779
}
6880
_tipIconView.image = [UIImage imageNamed:tipIconImageName];
6981
NSAttributedString *attrContent = [[self class] attrContentWithObj:_curActivity];
70-
CGFloat contentHeight = [attrContent boundingRectWithSize:CGSizeMake(kTaskActivityCell_ContentWidth, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size.height;
71-
[self.contentLabel setHeight:contentHeight];
82+
// CGFloat contentHeight = [attrContent boundingRectWithSize:CGSizeMake(kTaskActivityCell_ContentWidth, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size.height;
83+
// [self.contentLabel setHeight:contentHeight];
7284
self.contentLabel.attributedText = attrContent;
7385
}
7486

@@ -152,8 +164,9 @@ + (CGFloat)cellHeightWithObj:(id)obj{
152164
if ([obj isKindOfClass:[ProjectActivity class]]) {
153165
NSAttributedString *attrContent = [self attrContentWithObj:obj];
154166
CGFloat contentHeight = [attrContent boundingRectWithSize:CGSizeMake(kTaskActivityCell_ContentWidth, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size.height;
155-
cellHeight = ceilf(contentHeight + 26);
156-
cellHeight = MAX(44, cellHeight);
167+
contentHeight = MAX(contentHeight, kTaskActivityCell_IconWidth);
168+
169+
cellHeight = contentHeight + 16;
157170
}
158171
return cellHeight;
159172
}

Coding_iOS/Views/Cell/TaskCommentCell.m

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
//
88

99
#define kTaskCommentCell_FontContent [UIFont systemFontOfSize:15]
10-
#define kTaskCommentCell_LeftPading 30.0
11-
#define kTaskCommentCell_LeftContentPading (kTaskCommentCell_LeftPading + 40)
12-
#define kTaskCommentCell_ContentWidth (kScreen_Width - kTaskCommentCell_LeftContentPading - kTaskCommentCell_LeftPading)
10+
#define kTaskCommentCell_LeftContentPading (30 + 15 * 2 + 15)
11+
#define kTaskCommentCell_ContentWidth (kScreen_Width - kTaskCommentCell_LeftContentPading - 15 * 2)
1312

1413
#import "TaskCommentCell.h"
1514
#import "UICustomCollectionView.h"
@@ -34,7 +33,6 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
3433
if (self) {
3534
// Initialization code
3635
self.selectionStyle = UITableViewCellSelectionStyleNone;
37-
CGFloat curBottomY = 25;
3836
if (!_contentBGView) {
3937
_contentBGView = [UIImageView new];
4038
_contentBGView.image = [[UIImage imageNamed:@"comment_bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(35, 15, 5, 5)];
@@ -49,23 +47,22 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
4947
if (!_ownerIconView) {
5048
CGFloat borderWidth = 2;
5149

52-
UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth - borderWidth, curBottomY, 28+ 2*borderWidth, 28 + 2*borderWidth)];
50+
UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth - borderWidth, 12, 33+ 2*borderWidth, 33 + 2*borderWidth)];
5351
bgView.backgroundColor = kColorTableBG;
5452

55-
_ownerIconView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)];
53+
_ownerIconView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 33, 33)];
5654
_ownerIconView.layer.masksToBounds = YES;
5755
_ownerIconView.layer.cornerRadius = _ownerIconView.frame.size.width/2;
5856

5957
[bgView addSubview:_ownerIconView];
6058
[_ownerIconView mas_makeConstraints:^(MASConstraintMaker *make) {
61-
make.width.height.mas_equalTo(28.0);
59+
make.width.height.mas_equalTo(33.0);
6260
make.center.equalTo(bgView);
6361
}];
64-
6562
[self.contentView addSubview:bgView];
6663
}
6764
if (!_contentLabel) {
68-
_contentLabel = [[UITTTAttributedLabel alloc] initWithFrame:CGRectMake(kTaskCommentCell_LeftContentPading, curBottomY, kTaskCommentCell_ContentWidth, 30)];
65+
_contentLabel = [[UITTTAttributedLabel alloc] initWithFrame:CGRectMake(kTaskCommentCell_LeftContentPading, 7 + 15, kTaskCommentCell_ContentWidth, 30)];
6966
_contentLabel.textColor = kColor222;
7067
_contentLabel.font = kTaskCommentCell_FontContent;
7168
_contentLabel.linkAttributes = kLinkAttributes;
@@ -93,7 +90,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
9390
}
9491
}
9592
[_contentBGView mas_makeConstraints:^(MASConstraintMaker *make) {
96-
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(10, 60- 7, 10, 20));
93+
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(7, 33 + 15* 2 - 9, 7, 15));
9794
}];
9895
if (!_detailBtn) {
9996
_detailBtn = [UIButton buttonWithTitle:@"查看详情" titleColor:kColorBrandGreen];
@@ -122,7 +119,6 @@ - (void)setCurComment:(TaskComment *)curComment{
122119
return;
123120
}
124121
_detailBtn.hidden = ![self.curComment.htmlMedia needToShowDetail];
125-
CGFloat curBottomY = 25;
126122
[_ownerIconView sd_setImageWithURL:[_curComment.owner.avatar urlImageWithCodePathResizeToView:_ownerIconView] placeholderImage:kPlaceholderMonkeyRoundWidth(33.0)];
127123

128124
NSString *contentStr = _curComment.content;
@@ -134,19 +130,19 @@ - (void)setCurComment:(TaskComment *)curComment{
134130
}
135131
}
136132

137-
curBottomY += [contentStr getHeightWithFont:kTaskCommentCell_FontContent constrainedToSize:CGSizeMake(kTaskCommentCell_ContentWidth, CGFLOAT_MAX)] + 5;
133+
CGFloat curBottomY = CGRectGetMinY(_contentLabel.frame) + [contentStr getHeightWithFont:kTaskCommentCell_FontContent constrainedToSize:CGSizeMake(kTaskCommentCell_ContentWidth, CGFLOAT_MAX)];
138134

139135
NSInteger imagesCount = _curComment.htmlMedia.imageItems.count;
140136
if (imagesCount > 0) {
137+
curBottomY += 5;
141138
self.imageCollectionView.hidden = NO;
142139
[self.imageCollectionView setFrame:CGRectMake(kTaskCommentCell_LeftContentPading, curBottomY, kTaskCommentCell_ContentWidth, [TaskCommentCell imageCollectionViewHeightWithCount:imagesCount])];
143140
[self.imageCollectionView reloadData];
141+
curBottomY += [TaskCommentCell imageCollectionViewHeightWithCount:imagesCount];
144142
}else{
143+
curBottomY += 10;
145144
self.imageCollectionView.hidden = YES;
146145
}
147-
148-
curBottomY += [TaskCommentCell imageCollectionViewHeightWithCount:imagesCount];
149-
150146
[_timeLabel setY:curBottomY];
151147
_timeLabel.width = _detailBtn.hidden? kTaskCommentCell_ContentWidth: kTaskCommentCell_ContentWidth - 60;
152148
_timeLabel.text = [NSString stringWithFormat:@"%@ 发布于 %@", _curComment.owner.name, [_curComment.created_at stringDisplay_HHmm]];
@@ -172,9 +168,17 @@ + (CGFloat)cellHeightWithObj:(id)obj{
172168
|| [obj isKindOfClass:[FileComment class]]) {
173169
TaskComment *curComment = (TaskComment *)obj;
174170
NSString *contentStr = curComment.content;
175-
cellHeight += 20 +[contentStr getHeightWithFont:kTaskCommentCell_FontContent constrainedToSize:CGSizeMake(kTaskCommentCell_ContentWidth, CGFLOAT_MAX)] + 5 +20 +10;
176-
cellHeight += [self imageCollectionViewHeightWithCount:curComment.htmlMedia.imageItems.count];
171+
cellHeight += 7 + 15 +[contentStr getHeightWithFont:kTaskCommentCell_FontContent constrainedToSize:CGSizeMake(kTaskCommentCell_ContentWidth, CGFLOAT_MAX)];
172+
if (curComment.htmlMedia.imageItems.count > 0) {
173+
cellHeight += 5 + [self imageCollectionViewHeightWithCount:curComment.htmlMedia.imageItems.count];
174+
}else{
175+
cellHeight += 10;
176+
}
177177
cellHeight += 20;
178+
cellHeight += 15 + 7;
179+
// + 5 +20 +10;
180+
// cellHeight += [self imageCollectionViewHeightWithCount:curComment.htmlMedia.imageItems.count];
181+
// cellHeight += 20;
178182
}
179183
return cellHeight;
180184
}

0 commit comments

Comments
 (0)