Skip to content

Commit 30a903f

Browse files
author
panshiyu
committed
d2任务基本完成
1 parent 05e87c0 commit 30a903f

25 files changed

Lines changed: 682 additions & 225 deletions

.DS_Store

0 Bytes
Binary file not shown.

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,10 @@
769769
FE4CB43B1B618A6A0041E9EF /* CSTopicDetailVC.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4CB43A1B618A6A0041E9EF /* CSTopicDetailVC.m */; };
770770
FE4CB43D1B618EDC0041E9EF /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = FE4CB43C1B618EDC0041E9EF /* [email protected] */; };
771771
FE4CB4401B6194D10041E9EF /* CSTopiclistView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4CB43F1B6194D10041E9EF /* CSTopiclistView.m */; };
772-
FE4CB4431B619D280041E9EF /* Topic.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4CB4421B619D280041E9EF /* Topic.m */; };
772+
FE4CB4431B619D280041E9EF /* CSTopic.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4CB4421B619D280041E9EF /* CSTopic.m */; };
773+
FE4CB4461B6566260041E9EF /* CSTopicHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4CB4451B6566260041E9EF /* CSTopicHeaderView.m */; };
774+
FE4CB4491B65892F0041E9EF /* CSLikesVC.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4CB4481B65892F0041E9EF /* CSLikesVC.m */; };
775+
FE4CB44B1B65ABA00041E9EF /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = FE4CB44A1B65ABA00041E9EF /* [email protected] */; };
773776
FEC419251B53A39B00C498F5 /* CSSearchVC.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC419241B53A39B00C498F5 /* CSSearchVC.m */; };
774777
FEC419281B53A92600C498F5 /* CSSearchModel.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC419271B53A92600C498F5 /* CSSearchModel.m */; };
775778
FEC4192B1B53A9E300C498F5 /* TMCacheExtend.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC4192A1B53A9E300C498F5 /* TMCacheExtend.m */; };
@@ -1960,8 +1963,13 @@
19601963
FE4CB43C1B618EDC0041E9EF /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
19611964
FE4CB43E1B6194D10041E9EF /* CSTopiclistView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSTopiclistView.h; sourceTree = "<group>"; };
19621965
FE4CB43F1B6194D10041E9EF /* CSTopiclistView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSTopiclistView.m; sourceTree = "<group>"; };
1963-
FE4CB4411B619D280041E9EF /* Topic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Topic.h; sourceTree = "<group>"; };
1964-
FE4CB4421B619D280041E9EF /* Topic.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Topic.m; sourceTree = "<group>"; };
1966+
FE4CB4411B619D280041E9EF /* CSTopic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSTopic.h; sourceTree = "<group>"; };
1967+
FE4CB4421B619D280041E9EF /* CSTopic.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSTopic.m; sourceTree = "<group>"; };
1968+
FE4CB4441B6566260041E9EF /* CSTopicHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSTopicHeaderView.h; sourceTree = "<group>"; };
1969+
FE4CB4451B6566260041E9EF /* CSTopicHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSTopicHeaderView.m; sourceTree = "<group>"; };
1970+
FE4CB4471B65892F0041E9EF /* CSLikesVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSLikesVC.h; sourceTree = "<group>"; };
1971+
FE4CB4481B65892F0041E9EF /* CSLikesVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSLikesVC.m; sourceTree = "<group>"; };
1972+
FE4CB44A1B65ABA00041E9EF /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
19651973
FEC419231B53A39B00C498F5 /* CSSearchVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSearchVC.h; sourceTree = "<group>"; };
19661974
FEC419241B53A39B00C498F5 /* CSSearchVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSSearchVC.m; sourceTree = "<group>"; };
19671975
FEC419261B53A92600C498F5 /* CSSearchModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSearchModel.h; sourceTree = "<group>"; };
@@ -3320,6 +3328,7 @@
33203328
8EA6CFA619E240C40076D59C /* [email protected] */,
33213329
8EA6CFA819E240C40076D59C /* [email protected] */,
33223330
8EA6CFA919E240C40076D59C /* [email protected] */,
3331+
FE4CB44A1B65ABA00041E9EF /* [email protected] */,
33233332
8EA6CFBE19E240C40076D59C /* [email protected] */,
33243333
8E872CFD19EFEF0C002C8F34 /* [email protected] */,
33253334
8EA6CFC019E240C40076D59C /* [email protected] */,
@@ -3523,8 +3532,8 @@
35233532
8EA6CFF319E240C40076D59C /* Tweets.m */,
35243533
4ECD72ED1AAD7EC300D69AE1 /* Tweet.h */,
35253534
4ECD72EE1AAD7EC300D69AE1 /* Tweet.m */,
3526-
FE4CB4411B619D280041E9EF /* Topic.h */,
3527-
FE4CB4421B619D280041E9EF /* Topic.m */,
3535+
FE4CB4411B619D280041E9EF /* CSTopic.h */,
3536+
FE4CB4421B619D280041E9EF /* CSTopic.m */,
35283537
8EA6CFF619E240C40076D59C /* User.h */,
35293538
8EA6CFF719E240C40076D59C /* User.m */,
35303539
8EA6CFF819E240C40076D59C /* Users.h */,
@@ -4000,6 +4009,10 @@
40004009
FE4CB43A1B618A6A0041E9EF /* CSTopicDetailVC.m */,
40014010
FE4CB43E1B6194D10041E9EF /* CSTopiclistView.h */,
40024011
FE4CB43F1B6194D10041E9EF /* CSTopiclistView.m */,
4012+
FE4CB4441B6566260041E9EF /* CSTopicHeaderView.h */,
4013+
FE4CB4451B6566260041E9EF /* CSTopicHeaderView.m */,
4014+
FE4CB4471B65892F0041E9EF /* CSLikesVC.h */,
4015+
FE4CB4481B65892F0041E9EF /* CSLikesVC.m */,
40034016
);
40044017
path = Topic;
40054018
sourceTree = "<group>";
@@ -4346,6 +4359,7 @@
43464359
4E6383AA1B3262D300D98648 /* [email protected] in Resources */,
43474360
4E66EE281A28226000DA1B3E /* [email protected] in Resources */,
43484361
8E97CE4A1A0A2E11006F9AD7 /* EmojisList.plist in Resources */,
4362+
FE4CB44B1B65ABA00041E9EF /* [email protected] in Resources */,
43494363
4EBFBD181AA85B8500E4B10E /* [email protected] in Resources */,
43504364
8E97CEA21A0C7E26006F9AD7 /* [email protected] in Resources */,
43514365
4E996C061ABBF56A00C704F1 /* [email protected] in Resources */,
@@ -4564,6 +4578,7 @@
45644578
8E59F0FA1A00F3F3009A905F /* FileListFileCell.m in Sources */,
45654579
8EA6D14219E240C40076D59C /* TipsViewController.m in Sources */,
45664580
8EA6D1CA19E240C40076D59C /* UIPlaceHolderTextView.m in Sources */,
4581+
FE4CB4461B6566260041E9EF /* CSTopicHeaderView.m in Sources */,
45674582
4E4D6A6D1B1C68D700FD2E49 /* ProjectCommitsViewController.m in Sources */,
45684583
4E6BA2E61A1EE6AF005FD721 /* UIProgressView+AFNetworking.m in Sources */,
45694584
4EB0C2001A807ED00042FC4F /* NSURL+Common.m in Sources */,
@@ -4705,7 +4720,7 @@
47054720
4E6BA2D91A1EE6AF005FD721 /* AFURLConnectionOperation.m in Sources */,
47064721
8EA6D1BB19E240C40076D59C /* ProjectTopic.m in Sources */,
47074722
8EA6D13219E240C40076D59C /* RegisterViewController.m in Sources */,
4708-
FE4CB4431B619D280041E9EF /* Topic.m in Sources */,
4723+
FE4CB4431B619D280041E9EF /* CSTopic.m in Sources */,
47094724
8EF643C519FF7E2900F7EEB0 /* TitleRImageMoreCell.m in Sources */,
47104725
4E217F151A70EDC700F6DF88 /* SVWebViewControllerActivitySafari.m in Sources */,
47114726
4E8D5D5A1B45295D00B70936 /* HOTPGenerator.m in Sources */,
@@ -4858,6 +4873,7 @@
48584873
4E6FB0581B58DB0A00B0A17B /* ProjectTagsView.m in Sources */,
48594874
8EA6D1BA19E240C40076D59C /* Projects.m in Sources */,
48604875
FEF35ED01B56C2870000280F /* CSScrollview.m in Sources */,
4876+
FE4CB4491B65892F0041E9EF /* CSLikesVC.m in Sources */,
48614877
4E996BDF1ABA7CE100C704F1 /* UserInfoDetailUserCell.m in Sources */,
48624878
4EACB4461A2C60110097ABB3 /* ProjectActivities.m in Sources */,
48634879
8EA6D1CB19E240C40076D59C /* UITapImageView.m in Sources */,

Coding_iOS/.DS_Store

0 Bytes
Binary file not shown.

Coding_iOS/Controllers/LikersViewController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
@interface LikersViewController : BaseViewController<UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate,UISearchDisplayDelegate>
1313
@property (strong, nonatomic) Tweet *curTweet;
1414
@end
15+

Coding_iOS/Controllers/Search/CSSearchDisplayVC.m

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
#import "CSSearchCell.h"
2121
#import "UserInfoViewController.h"
2222
#import "WebViewController.h"
23+
#import "TweetDetailViewController.h"
2324

2425
#define kCellIdentifier_Search @"com.coding.search.tweet.result"
2526

26-
@interface CSSearchDisplayVC () <UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource>
27+
@interface CSSearchDisplayVC () <UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource,TopicHotkeyViewDelegate>
2728

2829
@property (nonatomic, strong) UIView *contentView;
2930
@property (nonatomic, strong) XHRealTimeBlur *backgroundView;
@@ -143,6 +144,7 @@ - (void)initSubViewsInContentView {
143144
[_contentView addSubview:moreIconView];
144145

145146
_topicHotkeyView = [[TopicHotkeyView alloc] init];
147+
_topicHotkeyView.delegate = self;
146148
[_contentView addSubview:_topicHotkeyView];
147149
[_topicHotkeyView mas_makeConstraints:^(MASConstraintMaker *make) {
148150

@@ -238,7 +240,7 @@ - (void)initSearchHistoryView {
238240

239241
make.top.mas_equalTo(_topicHotkeyView.mas_bottom);
240242
make.left.mas_equalTo(@0);
241-
make.width.mas_equalTo(@320);
243+
make.width.mas_equalTo(kScreen_Width);
242244
make.height.mas_equalTo(@280);
243245
}];
244246
}
@@ -249,33 +251,31 @@ - (void)initSearchHistoryView {
249251
CGFloat imageLeft = 12.0f;
250252
CGFloat textLeft = 34.0f;
251253
CGFloat height = 35.0f;
252-
UILabel *lblHistory = nil;
253-
UIImageView *imageView = nil;
254-
UIImageView *rightImageView = nil;
255-
UIImage *image = [UIImage imageNamed:@"time_clock_icon"];
256254

257255
for (int i = 0; i < array.count; i++) {
258256

259-
lblHistory = [[UILabel alloc] initWithFrame:CGRectMake(textLeft, i * height, kScreen_Width - textLeft, height)];
257+
UILabel *lblHistory = [[UILabel alloc] initWithFrame:CGRectMake(textLeft, i * height, kScreen_Width - textLeft, height)];
260258
lblHistory.userInteractionEnabled = YES;
261259
lblHistory.textColor = [UIColor colorWithHexString:@"0x999999"];
262260
lblHistory.text = array[i];
263261

264-
imageView = [[UIImageView alloc] initWithImage:image];
265-
imageView.frame = CGRectMake(imageLeft, i * height + (35 - image.size.height) / 2 + 2, image.size.width, image.size.height);
262+
UIImageView *leftView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 12, 12)];
263+
leftView.left = 12;
264+
leftView.centerY = lblHistory.centerY;
265+
leftView.image = [UIImage imageNamed:@"time_clock_icon"];
266+
267+
UIImageView *rightImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 14, 14)];
268+
rightImageView.right = kScreen_Width - 12;
269+
rightImageView.centerY = lblHistory.centerY;
270+
rightImageView.image = [UIImage imageNamed:@"icon_arrow_searchHistory"];
266271

267-
rightImageView = [[UIImageView alloc] initWithImage:image];
268-
rightImageView.frame = CGRectMake(kScreen_Width - textLeft, i * height + (35 - image.size.height) / 2 + 2, image.size.width, image.size.height);
269272

270273
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickedHistory:)];
271274
[lblHistory addGestureRecognizer:tapGestureRecognizer];
272275

273276
[_searchHistoryView addSubview:lblHistory];
274-
[_searchHistoryView addSubview:imageView];
277+
[_searchHistoryView addSubview:leftView];
275278
[_searchHistoryView addSubview:rightImageView];
276-
lblHistory = nil;
277-
imageView = nil;
278-
rightImageView = nil;
279279
}
280280

281281
if(array.count) {
@@ -335,6 +335,15 @@ - (void)didClickedHistory:(UIGestureRecognizer *)sender {
335335
[self initSearchResultsTableView];
336336
}
337337

338+
- (void)didClickHotkey:(NSString *)key {
339+
self.searchBar.text = key;
340+
[CSSearchModel addSearchHistory:self.searchBar.text];
341+
[self initSearchHistoryView];
342+
[self.searchBar resignFirstResponder];
343+
344+
[self initSearchResultsTableView];
345+
}
346+
338347
#pragma mark -
339348
#pragma mark Search Data Request
340349

@@ -384,7 +393,7 @@ - (void)requestDataWithPage:(NSInteger)page {
384393
}
385394

386395
weakSelf.isLoading = NO;
387-
weakSelf.headerLabel.text = [NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的冒泡", weakSelf.totalCount, weakSelf.searchBar.text, nil];
396+
weakSelf.headerLabel.text = [NSString stringWithFormat:@"共搜索到 %d 个与\"%@\"相关的冒泡", weakSelf.totalCount, weakSelf.searchBar.text, nil];
388397
}];
389398
}
390399

@@ -453,7 +462,22 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
453462
}
454463

455464
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
456-
465+
[tableView deselectRowAtIndexPath:indexPath animated:YES];
466+
Tweet *tweet = _tweetsArr[indexPath.row];
467+
468+
TweetDetailViewController *vc = [[TweetDetailViewController alloc] init];
469+
vc.curTweet = tweet;
470+
__weak typeof(self) weakSelf = self;
471+
vc.deleteTweetBlock = ^(Tweet *toDeleteTweet){
472+
// Tweets *curTweets = [weakSelf.tweetsDict objectForKey:[NSNumber numberWithInteger:weakSelf.curIndex]];
473+
// [curTweets.list removeObject:toDeleteTweet];
474+
// [weakSelf.myTableView reloadData];
475+
// [weakSelf.view configBlankPage:EaseBlankPageTypeTweet hasData:(curTweets.list.count > 0) hasError:NO reloadButtonBlock:^(id sender) {
476+
// [weakSelf sendRequest];
477+
// }];
478+
};
479+
[self.parentVC.parentViewController.navigationController pushViewController:vc animated:YES];
480+
457481
}
458482

459483
@end

Coding_iOS/Controllers/Topic/CSHotTopicVC.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@
88

99
#import <UIKit/UIKit.h>
1010
#import "CSScrollview.h"
11+
#import "SWTableViewCell.h"
12+
@class CSTopic;
1113

14+
#define kCellIdentifier_TopicCell @"kCellIdentifier_TopicCell"
1215
@interface CSHotTopicVC : UIViewController
1316

1417
@end
1518

1619
//普通cell
17-
@interface CSHotTopicCell : UITableViewCell
20+
@interface CSTopicCell : SWTableViewCell
1821

19-
- (void)updateDisplayByTopic:(id)data;
22+
- (void)updateDisplayByTopic:(NSDictionary*)data;
2023

2124
@end
2225

Coding_iOS/Controllers/Topic/CSHotTopicVC.m

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
#import "UILabel+Common.h"
1616
#import "Tweet.h"
1717

18-
#define kCellIdentifier_HotTopicCell @"kCellIdentifier_HotTopicCell"
18+
#import "CSTopic.h"
19+
#import "CSTopicDetailVC.h"
20+
21+
1922
#define kCellIdentifier_HotTopicTitleCell @"kCellIdentifier_HotTopicTitleCell"
2023

2124
@interface CSHotTopicVC ()<UITableViewDataSource,UITableViewDelegate>
@@ -43,7 +46,7 @@ - (void)viewDidLoad {
4346
tableView.dataSource = self;
4447
tableView.delegate = self;
4548
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
46-
[tableView registerClass:[CSHotTopicCell class] forCellReuseIdentifier:kCellIdentifier_HotTopicCell];
49+
[tableView registerClass:[CSTopicCell class] forCellReuseIdentifier:kCellIdentifier_TopicCell];
4750
[tableView registerClass:[CSHotTopicTitleCell class] forCellReuseIdentifier:kCellIdentifier_HotTopicTitleCell];
4851
[self.view addSubview:tableView];
4952
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -73,9 +76,9 @@ - (void)dealloc {
7376

7477
- (void)refreshHotTopiclist{
7578
__weak typeof(self) wself = self;
76-
[[Coding_NetAPIManager sharedManager] request_HotTopiclistWithBlock:^(id data, NSError *error) {
77-
if (data && [data isKindOfClass:[NSArray class]]) {
78-
wself.topiclist = [data copy];
79+
[[Coding_NetAPIManager sharedManager] request_HotTopiclistWithBlock:^(NSArray *topiclist, NSError *error) {
80+
if (topiclist) {
81+
wself.topiclist = [topiclist copy];
7982
}else {
8083
wself.topiclist = [NSArray array];
8184
}
@@ -110,9 +113,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
110113
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:12];
111114
return cell;
112115
}
113-
114-
id data = _topiclist[indexPath.row - 1];
115-
CSHotTopicCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_HotTopicCell forIndexPath:indexPath];
116+
NSDictionary *data = _topiclist[indexPath.row - 1];
117+
CSTopicCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TopicCell forIndexPath:indexPath];
116118
[cell updateDisplayByTopic:data];
117119
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:75];
118120
return cell;
@@ -132,21 +134,9 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
132134
return;
133135
}
134136

135-
id data = _topiclist[indexPath.row - 1];
136-
//TODO psy to topic detail page
137-
138-
// if (indexPath.row < 3) {
139-
// TipsViewController *vc = [[TipsViewController alloc] init];
140-
// vc.myCodingTips = [CodingTips codingTipsWithType:indexPath.row];
141-
// [self.navigationController pushViewController:vc animated:YES];
142-
// }else{
143-
// PrivateMessage *curMsg = [_myPriMsgs.list objectAtIndex:indexPath.row-3];
144-
// ConversationViewController *vc = [[ConversationViewController alloc] init];
145-
// User *curFriend = curMsg.friend;
146-
//
147-
// vc.myPriMsgs = [PrivateMessages priMsgsWithUser:curFriend];
148-
// [self.navigationController pushViewController:vc animated:YES];
149-
// }
137+
CSTopicDetailVC *vc = [[CSTopicDetailVC alloc] init];
138+
vc.topic = _topiclist[indexPath.row - 1];
139+
[self.navigationController pushViewController:vc animated:YES];
150140
}
151141

152142
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
@@ -207,14 +197,14 @@ - (void)onGoBack {
207197
#pragma mark -
208198

209199

210-
@interface CSHotTopicCell()<TTTAttributedLabelDelegate>
200+
@interface CSTopicCell()<TTTAttributedLabelDelegate>
211201
@property (nonatomic,strong)UILabel *nameLabel;
212202
@property (nonatomic,strong)UITTTAttributedLabel *contentLabel;
213203
@property (nonatomic,strong)UILabel *userCountLabel;
214204

215205
@end
216206

217-
@implementation CSHotTopicCell
207+
@implementation CSTopicCell
218208

219209
static CGFloat const kHotTopicCellPaddingRight = 15;
220210

@@ -244,7 +234,6 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
244234
[self.contentLabel addLongPressForCopy];
245235
[self.contentView addSubview:self.contentLabel];
246236

247-
248237
_userCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, 75, kScreen_Width - kPaddingLeftWidth - kHotTopicCellPaddingRight, 12)];
249238
_userCountLabel.font = [UIFont systemFontOfSize:12];
250239
_userCountLabel.backgroundColor = [UIColor clearColor];
@@ -255,19 +244,21 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
255244
return self;
256245
}
257246

258-
- (void)updateDisplayByTopic:(id)data {
247+
- (void)updateDisplayByTopic:(NSDictionary*)data {
248+
259249
_nameLabel.text = [NSString stringWithFormat:@"#%@#",data[@"name"]];
260250
_userCountLabel.text = [NSString stringWithFormat:@"%@人参与",data[@"user_count"]];
261251

262-
Tweet *tweet = [NSObject objectOfClass:@"Tweet" fromJSON:data[@"hot_tweet"]];
263-
[self.contentLabel setLongString:tweet.content withFitWidth:self.contentLabel.width maxHeight:40];
264-
self.contentLabel.centerY = self.height / 2;
265-
for (HtmlMediaItem *item in tweet.htmlMedia.mediaItems) {
266-
if (item.displayStr.length > 0 && !(item.type == HtmlMediaItemType_Code ||item.type == HtmlMediaItemType_EmotionEmoji)) {
267-
[self.contentLabel addLinkToTransitInformation:[NSDictionary dictionaryWithObject:item forKey:@"value"] withRange:item.range];
252+
if (data[@"hot_tweet"]) {
253+
Tweet *tweet = [NSObject objectOfClass:@"Tweet" fromJSON:data[@"hot_tweet"]];
254+
[self.contentLabel setLongString:tweet.content withFitWidth:self.contentLabel.width maxHeight:40];
255+
self.contentLabel.centerY = self.height / 2;
256+
for (HtmlMediaItem *item in tweet.htmlMedia.mediaItems) {
257+
if (item.displayStr.length > 0 && !(item.type == HtmlMediaItemType_Code ||item.type == HtmlMediaItemType_EmotionEmoji)) {
258+
[self.contentLabel addLinkToTransitInformation:[NSDictionary dictionaryWithObject:item forKey:@"value"] withRange:item.range];
259+
}
268260
}
269261
}
270-
271262
}
272263

273264
#pragma mark TTTAttributedLabelDelegate
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// CSLikesVC.h
3+
// Coding_iOS
4+
//
5+
// Created by pan Shiyu on 15/7/27.
6+
// Copyright (c) 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "LikersViewController.h"
10+
11+
@interface CSLikesVC : BaseViewController<UITableViewDataSource, UITableViewDelegate>
12+
13+
@property (nonatomic,strong)NSArray *userlist;
14+
15+
@end

0 commit comments

Comments
 (0)