Skip to content

Commit eb4305b

Browse files
committed
冒泡调整
1 parent 5c83826 commit eb4305b

12 files changed

+79
-92
lines changed

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@
386386
4EABD2571AD3CAAC005E515F /* UIMessageInputView_Add.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EABD2561AD3CAAC005E515F /* UIMessageInputView_Add.m */; };
387387
4EABD25A1AD3CB4A005E515F /* UIMessageInputView_CCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EABD2591AD3CB4A005E515F /* UIMessageInputView_CCell.m */; };
388388
4EABD25D1AD3CBB9005E515F /* UIMessageInputView_Media.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EABD25C1AD3CBB9005E515F /* UIMessageInputView_Media.m */; };
389+
4EAC8B6A1BA01F190060B0FC /* little_phone_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EAC8B691BA01F190060B0FC /* little_phone_icon@2x.png */; };
389390
4EACB43F1A2C448F0097ABB3 /* button_file_createFolder_unable@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EACB43C1A2C448F0097ABB3 /* button_file_createFolder_unable@2x.png */; };
390391
4EACB4401A2C448F0097ABB3 /* button_file_download_unable@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EACB43D1A2C448F0097ABB3 /* button_file_download_unable@2x.png */; };
391392
4EACB4411A2C448F0097ABB3 /* button_file_move_unable@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EACB43E1A2C448F0097ABB3 /* button_file_move_unable@2x.png */; };
@@ -1478,6 +1479,7 @@
14781479
4EABD2591AD3CB4A005E515F /* UIMessageInputView_CCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIMessageInputView_CCell.m; sourceTree = "<group>"; };
14791480
4EABD25B1AD3CBB9005E515F /* UIMessageInputView_Media.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIMessageInputView_Media.h; sourceTree = "<group>"; };
14801481
4EABD25C1AD3CBB9005E515F /* UIMessageInputView_Media.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIMessageInputView_Media.m; sourceTree = "<group>"; };
1482+
4EAC8B691BA01F190060B0FC /* little_phone_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "little_phone_icon@2x.png"; sourceTree = "<group>"; };
14811483
4EACB43C1A2C448F0097ABB3 /* button_file_createFolder_unable@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button_file_createFolder_unable@2x.png"; sourceTree = "<group>"; };
14821484
4EACB43D1A2C448F0097ABB3 /* button_file_download_unable@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button_file_download_unable@2x.png"; sourceTree = "<group>"; };
14831485
4EACB43E1A2C448F0097ABB3 /* button_file_move_unable@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button_file_move_unable@2x.png"; sourceTree = "<group>"; };
@@ -3926,6 +3928,7 @@
39263928
4E62410A1B74D65400E1533C /* search_tweet_like@2x.png */,
39273929
4EAE068F1B784E9200179F4B /* store_icon@2x.png */,
39283930
4EAE06911B7880BA00179F4B /* me_info_arrow_left@2x.png */,
3931+
4EAC8B691BA01F190060B0FC /* little_phone_icon@2x.png */,
39293932
);
39303933
path = Images;
39313934
sourceTree = "<group>";
@@ -4679,6 +4682,7 @@
46794682
4EF17ED71B3C3112003CDD2D /* intro_icon_4@2x.png in Resources */,
46804683
4E6384031B33C8E900D98648 /* task_activity_icon_create@2x.png in Resources */,
46814684
4EACB4401A2C448F0097ABB3 /* button_file_download_unable@2x.png in Resources */,
4685+
4EAC8B6A1BA01F190060B0FC /* little_phone_icon@2x.png in Resources */,
46824686
4E2BF3D41B96CDF800A5A0A8 /* share_btn_sina@2x.png in Resources */,
46834687
8E8F7B2F19EF6306006BA8BD /* btn_privateMsg_black@2x.png in Resources */,
46844688
4E96E7E01A1B537E0037C098 /* icon_file_pdf@2x.png in Resources */,

Coding_iOS/Controllers/RootControllers/Tweet_RootViewController.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -483,14 +483,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
483483
cell.mediaItemClickedBlock = ^(HtmlMediaItem *curItem){
484484
[weakSelf analyseLinkStr:curItem.href];
485485
};
486-
cell.locationClickedBlock = ^(Tweet *curTweet){
487-
TweetSendLocationDetailViewController *vc = [[TweetSendLocationDetailViewController alloc]init];
488-
vc.tweet = curTweet;
489-
490-
if (vc.tweet.coord.length > 0) {
491-
[weakSelf.navigationController pushViewController:vc animated:YES];
492-
}
493-
};
494486

495487
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:0];
496488
return cell;

Coding_iOS/Controllers/TweetDetailViewController.m

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
244244
cell.loadRequestBlock = ^(NSURLRequest *curRequest){
245245
[self loadRequest:curRequest];
246246
};
247-
__weak typeof (self)weakSelf = self;
248-
cell.locationClickedBlock = ^(Tweet *curTweet){
249-
TweetSendLocationDetailViewController *vc = [[TweetSendLocationDetailViewController alloc]init];
250-
vc.tweet = curTweet;
251-
if (vc.tweet.coord.length > 0) {
252-
[weakSelf.navigationController pushViewController:vc animated:YES];
253-
254-
}
255-
};
256247
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:0];
257248
return cell;
258249
}else{
496 Bytes
Loading
Loading
68 Bytes
Loading
Loading
Loading

Coding_iOS/Views/Cell/TweetCell.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ typedef void (^LocationClickedBlock) (Tweet *curTweet);
2929
@property (nonatomic, copy) UserBtnClickedBlock userBtnClickedBlock;
3030
@property (nonatomic, copy) MoreLikersBtnClickedBlock moreLikersBtnClickedBlock;
3131
@property (nonatomic, copy) DeleteClickedBlock deleteClickedBlock;
32-
@property (nonatomic, copy) LocationClickedBlock locationClickedBlock;
3332
@property (nonatomic, copy) void(^goToDetailTweetBlock) (Tweet *curTweet);
3433
@property (copy, nonatomic) void (^refreshSingleCCellBlock)();
3534
@property (copy, nonatomic) void (^mediaItemClickedBlock)(HtmlMediaItem *curItem);

Coding_iOS/Views/Cell/TweetCell.m

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

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

1212
#define kTweetCell_PadingBottom 10.0
1313
#define kTweetCell_ContentWidth (kScreen_Width -kTweetCell_PadingLeft - kPaddingLeftWidth)
@@ -31,6 +31,7 @@
3131
#import "MJPhotoBrowser.h"
3232
#import "UICustomCollectionView.h"
3333
#import "CodingShareView.h"
34+
#import "TweetSendLocationDetailViewController.h"
3435

3536
@interface TweetCell ()
3637
@property (strong, nonatomic) Tweet *tweet;
@@ -46,7 +47,7 @@ @interface TweetCell ()
4647
@property (strong, nonatomic) UICustomCollectionView *mediaView;
4748
@property (strong, nonatomic) UICollectionView *likeUsersView;
4849
@property (strong, nonatomic) UITableView *commentListView;
49-
@property (strong, nonatomic) UIImageView *timeClockIconView, *commentOrLikeBeginImgView, *commentOrLikeSplitlineView;
50+
@property (strong, nonatomic) UIImageView *timeClockIconView, *commentOrLikeBeginImgView, *commentOrLikeSplitlineView, *fromPhoneIconView;
5051
@end
5152

5253
@implementation TweetCell
@@ -71,7 +72,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
7172
}
7273

7374
if (!self.ownerImgView) {
74-
self.ownerImgView = [[UITapImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, 15 + CGRectGetMaxY(_topView.frame), 33, 33)];
75+
self.ownerImgView = [[UITapImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, 15 + CGRectGetMaxY(_topView.frame), 35, 35)];
7576
[self.ownerImgView doCircleFrame];
7677
[self.contentView addSubview:self.ownerImgView];
7778
}
@@ -142,13 +143,14 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
142143
[self.locaitonBtn addTarget:self action:@selector(locationBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
143144
[self.contentView addSubview:self.locaitonBtn];
144145
}
145-
146+
if (!self.fromPhoneIconView) {
147+
self.fromPhoneIconView = [[UIImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, 0, 15, 15)];
148+
self.fromPhoneIconView.image = [UIImage imageNamed:@"little_phone_icon"];
149+
[self.contentView addSubview:self.fromPhoneIconView];
150+
}
146151
if (!self.fromLabel) {
147-
self.fromLabel = [[UILabel alloc] initWithFrame:CGRectMake(kTweetCell_PadingLeft, 0, 100, 15)];
152+
self.fromLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.fromPhoneIconView.frame) + 5, 0, kScreen_Width/2, 15)];
148153
self.fromLabel.font = kTweet_TimtFont;
149-
self.fromLabel.minimumScaleFactor = 0.50;
150-
self.fromLabel.adjustsFontSizeToFitWidth = YES;
151-
self.fromLabel.textAlignment = NSTextAlignmentLeft;
152154
self.fromLabel.textColor = [UIColor colorWithHexString:@"0x999999"];
153155
[self.contentView addSubview:self.fromLabel];
154156
}
@@ -224,6 +226,8 @@ - (void)layoutSubviews{
224226
if (!_tweet) {
225227
return;
226228
}
229+
BOOL isMineTweet = [_tweet.owner.global_key isEqualToString:[Login curLoginUser].global_key];
230+
227231
self.topView.hidden = !_needTopView;
228232
//owner头像
229233
__weak __typeof(self)weakSelf = self;
@@ -238,8 +242,7 @@ - (void)layoutSubviews{
238242
[self.timeLabel setX:timeLabelX];
239243
[self.timeClockIconView setX:timeLabelX-15];
240244

241-
242-
CGFloat centerY = 15 + 15 + 33.0/2;
245+
CGFloat centerY = 15 + 15 + CGRectGetHeight(_ownerImgView.frame)/2;
243246
CGFloat curBottomY = _needTopView? 0: -15;
244247
centerY += curBottomY;
245248

@@ -252,9 +255,6 @@ - (void)layoutSubviews{
252255
curBottomY += kTweetCell_PadingTop;
253256

254257
//owner冒泡text内容
255-
// [self.contentLabel setWidth:kTweetCell_ContentWidth];
256-
// self.contentLabel.text = _tweet.content;
257-
// [self.contentLabel sizeToFit];
258258
[self.contentLabel setY:curBottomY];
259259
[self.contentLabel setLongString:_tweet.content withFitWidth:kTweetCell_ContentWidth maxHeight:kTweet_ContentMaxHeight];
260260
for (HtmlMediaItem *item in _tweet.htmlMedia.mediaItems) {
@@ -277,40 +277,32 @@ - (void)layoutSubviews{
277277
}
278278
}
279279

280-
BOOL isMineTweet = [_tweet.owner.global_key isEqualToString:[Login curLoginUser].global_key];
281-
282280
//地址&设备小尾巴
283281
if (_tweet.location.length > 0 || _tweet.device.length > 0) {
284-
CGFloat curX = kPaddingLeftWidth;
285282
if (_tweet.location.length > 0) {
286283
[self.locaitonBtn setTitle:_tweet.location forState:UIControlStateNormal];
287-
CGFloat titleWidth = [self.locaitonBtn.titleLabel.text getWidthWithFont:self.locaitonBtn.titleLabel.font constrainedToSize:CGSizeMake(kScreen_Width, 15)];
288-
self.locaitonBtn.frame = CGRectMake(curX, curBottomY, titleWidth, 15);
289-
curX += titleWidth +5;
284+
[self.locaitonBtn setY:curBottomY];
285+
curBottomY += _tweet.device.length > 0? 20: 15;
290286
}
291-
if(_tweet.device.length > 0) {
287+
if (_tweet.device.length > 0) {
292288
self.fromLabel.text = [NSString stringWithFormat:@"来自 %@", _tweet.device];
293-
CGFloat titleWidth = [self.fromLabel.text getWidthWithFont:self.fromLabel.font constrainedToSize:CGSizeMake(kScreen_Width, 15)];
294-
titleWidth = MIN(titleWidth, kScreen_Width - kPaddingLeftWidth - curX);
295-
self.fromLabel.frame = CGRectMake(curX, curBottomY, titleWidth, 15);
289+
[self.fromLabel setY:curBottomY];
290+
[self.fromPhoneIconView setCenterY:self.fromLabel.centerY];
291+
curBottomY += 15;
296292
}
297-
curBottomY += 30;
293+
curBottomY += 15;
298294
}
299295
self.locaitonBtn.hidden = _tweet.location.length <= 0;
300-
self.fromLabel.hidden = _tweet.device.length <= 0;
296+
self.fromLabel.hidden = self.fromPhoneIconView.hidden = _tweet.device.length <= 0;
301297

302298
//喜欢&评论 按钮
303299
[self.likeBtn setImage:[UIImage imageNamed:(_tweet.liked.boolValue? @"tweet_btn_liked":@"tweet_btn_like")] forState:UIControlStateNormal];
304300
[self.likeBtn setY:curBottomY];
305301
[self.commentBtn setY:curBottomY];
306302
[self.shareBtn setY:curBottomY];
307303

308-
if (isMineTweet) {
309-
[self.deleteBtn setY:curBottomY];
310-
self.deleteBtn.hidden = NO;
311-
}else{
312-
self.deleteBtn.hidden = YES;
313-
}
304+
[self.deleteBtn setY:curBottomY];
305+
self.deleteBtn.hidden = !isMineTweet;
314306

315307
curBottomY += kTweetCell_LikeComment_Height;
316308
curBottomY += [TweetCell likeCommentBtn_BottomPadingWithTweet:_tweet];
@@ -364,7 +356,7 @@ + (CGFloat)cellHeightWithObj:(id)obj needTopView:(BOOL)needTopView{
364356
cellHeight += kTweetCell_PadingTop;
365357
cellHeight += [self contentLabelHeightWithTweet:tweet];
366358
cellHeight += [self contentMediaHeightWithTweet:tweet];
367-
cellHeight += [self locationHeightWithTweet:tweet];
359+
cellHeight += [self locationAndDeviceHeightWithTweet:tweet];
368360
cellHeight += kTweetCell_LikeComment_Height;
369361
cellHeight += [TweetCell likeCommentBtn_BottomPadingWithTweet:tweet];
370362
cellHeight += [TweetCell likeUsersHeightWithTweet:tweet];
@@ -405,14 +397,18 @@ + (CGFloat)likeCommentBtn_BottomPadingWithTweet:(Tweet *)tweet{
405397
}
406398
}
407399

408-
+ (CGFloat)locationHeightWithTweet:(Tweet *)tweet{
409-
CGFloat ocationHeight = 0;
400+
+ (CGFloat)locationAndDeviceHeightWithTweet:(Tweet *)tweet{
401+
CGFloat height = 0;
410402
if (tweet.location.length > 0 || tweet.device.length > 0) {
411-
ocationHeight = 15 + 15;
412-
}else{
413-
ocationHeight = 0;
403+
if (tweet.location.length > 0) {
404+
height += tweet.device.length > 0? 20: 15;
405+
}
406+
if (tweet.device.length > 0) {
407+
height += 15;
408+
}
409+
height += 15;
414410
}
415-
return ocationHeight;
411+
return height;
416412
}
417413

418414

@@ -658,8 +654,11 @@ - (void)userBtnClicked{
658654
}
659655
}
660656
- (void)locationBtnClicked:(id)sender{
661-
if (_locationClickedBlock) {
662-
_locationClickedBlock(_tweet);
657+
TweetSendLocationDetailViewController *vc = [[TweetSendLocationDetailViewController alloc]init];
658+
vc.tweet = _tweet;
659+
if (vc.tweet.coord.length > 0) {
660+
[[BaseViewController presentingVC].navigationController pushViewController:vc animated:YES];
661+
663662
}
664663
}
665664
- (void)shareBtnClicked:(id)sender{

Coding_iOS/Views/Cell/TweetDetailCell.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,5 @@
2222
@property (nonatomic, copy) void (^cellHeightChangedBlock) ();
2323
@property (nonatomic, copy) void (^loadRequestBlock)(NSURLRequest *curRequest);
2424

25-
@property (nonatomic, copy) void (^locationClickedBlock) (Tweet *curTweet);
26-
2725
+ (CGFloat)cellHeightWithObj:(id)obj;
2826
@end

0 commit comments

Comments
 (0)