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

Sign up
Appearance settings

Commit 7f6c8b8

Browse files
TweetCell - 调整
1 parent 8eb8a76 commit 7f6c8b8

File tree

6 files changed

+39
-31
lines changed

6 files changed

+39
-31
lines changed

‎Coding_iOS/Util/OC_Category/UIButton+Common.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ - (void)userNameStyle{
5252
self.layer.cornerRadius = 2.0;
5353
self.titleLabel.font = [UIFont systemFontOfSize:17];
5454
// [self setTitleColor:kColor222 forState:UIControlStateNormal];
55-
[self setTitleColor:kColorBrandGreen forState:UIControlStateNormal];
55+
[self setTitleColor:kColorDark3 forState:UIControlStateNormal];
5656
[self setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:UIControlStateNormal];
5757
[self setBackgroundImage:[UIImage imageWithColor:[UIColor lightGrayColor]] forState:UIControlStateHighlighted];
5858
}
@@ -129,7 +129,7 @@ + (UIButton *)tweetBtnWithFrame:(CGRect)frame alignmentLeft:(BOOL)alignmentLeft{
129129
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
130130
button.frame = frame;
131131
button.titleLabel.font = [UIFont systemFontOfSize:12];
132-
[button setTitleColor:kColor999 forState:UIControlStateNormal];
132+
[button setTitleColor:kColorDark7 forState:UIControlStateNormal];
133133
if (alignmentLeft) {
134134
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
135135
button.imageEdgeInsets = UIEdgeInsetsMake(0, 5, 0, -5);

‎Coding_iOS/Views/CCell/TweetLikeUserCCell.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515

1616
- (void)configWithUser:(User *)user rewarded:(BOOL)rewarded;
1717

18+
+(CGSize)ccellSize;
1819
@end

‎Coding_iOS/Views/CCell/TweetLikeUserCCell.m

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

9-
#define kTweetCell_LikeUserCCell_Height 25.0
9+
#define kTweetCell_LikeUserCCell_Height 30.0
1010

1111
#import "TweetLikeUserCCell.h"
1212

@@ -50,4 +50,9 @@ - (void)configWithUser:(User *)user rewarded:(BOOL)rewarded{
5050
- (void)layoutSubviews{
5151
[super layoutSubviews];
5252
}
53+
54+
+(CGSize)ccellSize{
55+
CGSize itemSize = CGSizeMake(kTweetCell_LikeUserCCell_Height, kTweetCell_LikeUserCCell_Height);
56+
return itemSize;
57+
}
5358
@end

‎Coding_iOS/Views/Cell/TweetCell.m

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

99
#define kTweetCell_PadingLeft kPaddingLeftWidth
10-
#define kTweetCell_PadingTop (65 + 15)
10+
#define kTweetCell_PadingTop (75 + 15)
1111

1212
#define kTweetCell_PadingBottom 10.0
1313
#define kTweetCell_ContentWidth (kScreen_Width -kTweetCell_PadingLeft - kPaddingLeftWidth)
1414
#define kTweetCell_LikeComment_Height 27.0
1515
#define kTweetCell_LikeComment_Width 50.0
16-
#define kTweetCell_LikeUserCCell_Height 26.0
17-
#define kTweetCell_LikeUserCCell_Pading 10.0
16+
#define kTweetCell_LikeUserCCell_Height 30.0
17+
#define kTweetCell_LikeUserCCell_Pading 5.0
1818
#define kTweet_ContentFont [UIFont systemFontOfSize:16]
1919
#define kTweet_ContentMaxHeight 200.0
2020
#define kTweet_CommentFont [UIFont systemFontOfSize:14]
2121
#define kTweet_TimtFont [UIFont systemFontOfSize:12]
2222
#define kTweet_LikeUsersLineCount 7.0
2323

24-
#define kTweetCell_MaxCollectionNum (kDevice_Is_iPhone6Plus? 12: kDevice_Is_iPhone6? 10 : 9)
24+
#define kTweetCell_MaxCollectionNum (kDevice_Is_iPhone6Plus? 10: kDevice_Is_iPhone6? 9 : 8)
2525

2626
#import "TweetCell.h"
2727
#import "TweetLikeUserCCell.h"
@@ -69,13 +69,13 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
6969
}
7070

7171
if (!self.ownerImgView) {
72-
self.ownerImgView = [[UITapImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, 15 + CGRectGetMaxY(_topView.frame), 38, 38)];
72+
self.ownerImgView = [[UITapImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, 15 + CGRectGetMaxY(_topView.frame), 45, 45)];
7373
[self.ownerImgView doCircleFrame];
7474
[self.contentView addSubview:self.ownerImgView];
7575
}
7676
if (!self.ownerNameBtn) {
7777
self.ownerNameBtn = [UIButton buttonWithUserStyle];
78-
self.ownerNameBtn.frame = CGRectMake(CGRectGetMaxX(self.ownerImgView.frame) + 10, 23 + CGRectGetMaxY(_topView.frame), 50, 20);
78+
self.ownerNameBtn.frame = CGRectMake(CGRectGetMaxX(self.ownerImgView.frame) + 15, 23 + CGRectGetMaxY(_topView.frame), 50, 24);
7979
[self.ownerNameBtn addTarget:self action:@selector(userBtnClicked) forControlEvents:UIControlEventTouchUpInside];
8080
[self.contentView addSubview:self.ownerNameBtn];
8181
}
@@ -85,17 +85,17 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
8585
// [self.contentView addSubview:self.timeClockIconView];
8686
// }
8787
if (!self.timeLabel) {
88-
self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.ownerNameBtn.frame), 0, kScreen_Width/2, 12)];
88+
self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.ownerNameBtn.frame), 0, kScreen_Width/2, 15)];
8989
// self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kScreen_Width - kPaddingLeftWidth - 55, 23 + CGRectGetMaxY(_topView.frame), 55, 12)];
9090
self.timeLabel.font = kTweet_TimtFont;
9191
// self.timeLabel.textAlignment = NSTextAlignmentRight;
92-
self.timeLabel.textColor = kColor999;
92+
self.timeLabel.textColor = kColorDark7;
9393
[self.contentView addSubview:self.timeLabel];
9494
}
9595
if (!self.contentLabel) {
9696
self.contentLabel = [[UITTTAttributedLabel alloc] initWithFrame:CGRectMake(kTweetCell_PadingLeft, kTweetCell_PadingTop, kTweetCell_ContentWidth, 20)];
9797
self.contentLabel.font = kTweet_ContentFont;
98-
self.contentLabel.textColor = kColor222;
98+
self.contentLabel.textColor = kColorDark3;
9999
self.contentLabel.numberOfLines = 0;
100100

101101
self.contentLabel.linkAttributes = kLinkAttributes;
@@ -153,7 +153,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
153153
if (!self.fromLabel) {
154154
self.fromLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.fromPhoneIconView.frame) + 5, 0, kScreen_Width/2, 15)];
155155
self.fromLabel.font = kTweet_TimtFont;
156-
self.fromLabel.textColor = kColor999;
156+
self.fromLabel.textColor = kColorDark7;
157157
[self.contentView addSubview:self.fromLabel];
158158
}
159159

@@ -416,7 +416,7 @@ + (CGFloat)locationAndDeviceHeightWithTweet:(Tweet *)tweet{
416416
+ (CGFloat)likeUsersHeightWithTweet:(Tweet *)tweet{
417417
CGFloat likeUsersHeight = 0;
418418
if ([tweet hasLikesOrRewards]) {
419-
likeUsersHeight = 45;
419+
likeUsersHeight = [TweetLikeUserCCell ccellSize].height + 20;
420420
// +30*(ceilf([tweet.like_users count]/kTweet_LikeUsersLineCount)-1);
421421
}
422422
return likeUsersHeight;
@@ -494,7 +494,7 @@ - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollection
494494
itemSize = [TweetMediaItemCCell ccellSizeWithObj:_tweet.htmlMedia.imageItems.firstObject];
495495
}
496496
}else{
497-
itemSize = CGSizeMake(kTweetCell_LikeUserCCell_Height, kTweetCell_LikeUserCCell_Height);
497+
itemSize = [TweetLikeUserCCell ccellSize];
498498
}
499499
return itemSize;
500500
}
@@ -508,7 +508,7 @@ - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UIColl
508508
insetForSection = UIEdgeInsetsMake(0, 0, 0, 0);
509509
}
510510
}else{
511-
insetForSection = UIEdgeInsetsMake(kTweetCell_LikeUserCCell_Pading, 5, kTweetCell_LikeUserCCell_Pading, 5);
511+
insetForSection = UIEdgeInsetsMake(10, kPaddingLeftWidth, 10, kPaddingLeftWidth);
512512
}
513513
return insetForSection;
514514
}

‎Coding_iOS/Views/Cell/TweetCommentCell.m

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
3131
// Initialization code
3232
self.backgroundView = nil;
3333
if (!_commentLabel) {
34-
_commentLabel = [[UITTTAttributedLabel alloc] initWithFrame:CGRectMake(kTweetCommentCell_LeftOrRightPading, kScaleFrom_iPhone5_Desgin(6), kTweetCommentCell_ContentWidth, 20)];
34+
_commentLabel = [[UITTTAttributedLabel alloc] initWithFrame:CGRectMake(kTweetCommentCell_LeftOrRightPading, 10, kTweetCommentCell_ContentWidth, 20)];
3535
_commentLabel.numberOfLines = 0;
3636
_commentLabel.backgroundColor = [UIColor clearColor];
3737
_commentLabel.font = kTweet_CommentFont;
38-
_commentLabel.textColor = kColor222;
38+
_commentLabel.textColor = kColorDark4;
3939
_commentLabel.linkAttributes = kLinkAttributes;
4040
_commentLabel.activeLinkAttributes = kLinkAttributesActive;
4141
[self.contentView addSubview:_commentLabel];
@@ -44,19 +44,20 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
4444
if (!_userNameLabel) {
4545
_userNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(kTweetCommentCell_LeftOrRightPading, 0, 150, 15)];
4646
_userNameLabel.backgroundColor = [UIColor clearColor];
47-
_userNameLabel.font = [UIFont boldSystemFontOfSize:10];
48-
_userNameLabel.textColor = kColor666;
47+
_userNameLabel.font = [UIFont boldSystemFontOfSize:12];
48+
_userNameLabel.textColor = kColorDark7;
4949
[self.contentView addSubview:_userNameLabel];
5050
}
5151
if (!_timeLabel) {
5252
_timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(75, 0, 80, 15)];
5353
_timeLabel.backgroundColor = [UIColor clearColor];
54-
_timeLabel.font = [UIFont systemFontOfSize:10];
55-
_timeLabel.textColor = kColor999;
54+
_timeLabel.font = [UIFont systemFontOfSize:12];
55+
_timeLabel.textColor = kColorDark7;
5656
[self.contentView addSubview:_timeLabel];
5757
}
5858
if (!_timeClockIconView) {
59-
_timeClockIconView = [[UIImageView alloc] initWithFrame:CGRectMake(60, 0, 12, 12)];
59+
_timeClockIconView = [[UIImageView alloc] initWithFrame:CGRectMake(60, 0, 15, 15)];
60+
_timeClockIconView.contentMode = UIViewContentModeCenter;
6061
_timeClockIconView.image = [UIImage imageNamed:@"time_clock_icon"];
6162
[self.contentView addSubview:_timeClockIconView];
6263
}
@@ -89,7 +90,7 @@ - (void)configWithComment:(Comment *)curComment topLine:(BOOL)has{
8990
[_commentLabel addLinkToTransitInformation:[NSDictionary dictionaryWithObject:item forKey:@"value"] withRange:item.range];
9091
}
9192
}
92-
CGFloat curBottomY = CGRectGetMaxY(_commentLabel.frame) +kScaleFrom_iPhone5_Desgin(5);
93+
CGFloat curBottomY = CGRectGetMaxY(_commentLabel.frame) +10;
9394

9495
_userNameLabel.text = curUser.name;
9596
_timeLabel.text = [_curComment.created_at stringDisplay_HHmm];
@@ -98,10 +99,10 @@ - (void)configWithComment:(Comment *)curComment topLine:(BOOL)has{
9899

99100
CGRect frame = _timeClockIconView.frame;
100101
frame.origin.y = curBottomY;
101-
frame.origin.x = 15+ CGRectGetWidth(_userNameLabel.frame);
102+
frame.origin.x = 10 + CGRectGetMaxX(_userNameLabel.frame);
102103
_timeClockIconView.frame = frame;
103104

104-
frame.origin.x += 15;
105+
frame.origin.x += 5 + CGRectGetWidth(_timeClockIconView.frame);
105106
frame.size = _timeLabel.frame.size;
106107
_timeLabel.frame = frame;
107108
[_timeLabel sizeToFit];
@@ -111,7 +112,7 @@ + (CGFloat)cellHeightWithObj:(id)obj{
111112
CGFloat cellHeight = 0;
112113
if ([obj isKindOfClass:[Comment class]]) {
113114
Comment *curComment = (Comment *)obj;
114-
cellHeight = MIN(kTweetCommentCell_ContentMaxHeight, [curComment.content getHeightWithFont:kTweet_CommentFont constrainedToSize:CGSizeMake(kTweetCommentCell_ContentWidth, CGFLOAT_MAX)]) +15 + kScaleFrom_iPhone5_Desgin(15);
115+
cellHeight = MIN(kTweetCommentCell_ContentMaxHeight, [curComment.content getHeightWithFont:kTweet_CommentFont constrainedToSize:CGSizeMake(kTweetCommentCell_ContentWidth, CGFLOAT_MAX)]) +15 + 10 * 3;
115116
}
116117
return ceilf(cellHeight);
117118
}

‎Coding_iOS/Views/Cell/TweetCommentMoreCell.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
2323
if (self) {
2424
// Initialization code
2525
if (!_commentIconView) {
26-
_commentIconView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 13, 13)];
26+
_commentIconView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 20, 20)];
2727
_commentIconView.image = [UIImage imageNamed:@"tweet_more_comment_icon"];
28+
_commentIconView.contentMode = UIViewContentModeCenter;
2829
[self.contentView addSubview:_commentIconView];
2930
}
3031
if (!_contentLabel) {
31-
_contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(30, 5, 245, 20)];
32+
_contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(30, 10, 245, 20)];
3233
_contentLabel.backgroundColor = [UIColor clearColor];
3334
_contentLabel.font = kTweet_CommentFont;
34-
_contentLabel.textColor = kColor222;
35+
_contentLabel.textColor = kColorDark4;
3536
[self.contentView addSubview:_contentLabel];
3637
}
3738
if (!_splitLineView) {
@@ -53,6 +54,6 @@ - (void)layoutSubviews{
5354
self.contentLabel.text = [NSString stringWithFormat:@"查看全部%d条评论", _commentNum.intValue];
5455
}
5556
+(CGFloat)cellHeight{
56-
return 12+10*2;
57+
return 20 + 10*2;
5758
}
5859
@end

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /