Skip to content

Commit 914977b

Browse files
committed
搜索进一步完善~
1 parent f711190 commit 914977b

11 files changed

Lines changed: 434 additions & 48 deletions

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,8 @@
902902
D09AA5B11BFCBABC008CA9EB /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D09AA5B01BFCBABC008CA9EB /* [email protected] */; };
903903
D09AA5B71BFDA38D008CA9EB /* AllSearchDisplayVC.m in Sources */ = {isa = PBXBuildFile; fileRef = D09AA5B61BFDA38D008CA9EB /* AllSearchDisplayVC.m */; };
904904
D09AA5BA1BFDBA4B008CA9EB /* PublicSearchModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D09AA5B91BFDBA4B008CA9EB /* PublicSearchModel.m */; };
905+
D09AA5BD1BFDE5F5008CA9EB /* TweetSearchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D09AA5BC1BFDE5F5008CA9EB /* TweetSearchCell.m */; };
906+
D09AA5C01BFDEDD1008CA9EB /* NSString+Attribute.m in Sources */ = {isa = PBXBuildFile; fileRef = D09AA5BF1BFDEDD1008CA9EB /* NSString+Attribute.m */; };
905907
D09E6AAF1BF826AC009D37F8 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D09E6AA51BF826AC009D37F8 /* [email protected] */; };
906908
D09E6AB01BF826AC009D37F8 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D09E6AA61BF826AC009D37F8 /* [email protected] */; };
907909
D09E6AB11BF826AC009D37F8 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D09E6AA71BF826AC009D37F8 /* [email protected] */; };
@@ -2321,6 +2323,10 @@
23212323
D09AA5B61BFDA38D008CA9EB /* AllSearchDisplayVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllSearchDisplayVC.m; sourceTree = "<group>"; };
23222324
D09AA5B81BFDBA4B008CA9EB /* PublicSearchModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicSearchModel.h; sourceTree = "<group>"; };
23232325
D09AA5B91BFDBA4B008CA9EB /* PublicSearchModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PublicSearchModel.m; sourceTree = "<group>"; };
2326+
D09AA5BB1BFDE5F5008CA9EB /* TweetSearchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TweetSearchCell.h; sourceTree = "<group>"; };
2327+
D09AA5BC1BFDE5F5008CA9EB /* TweetSearchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TweetSearchCell.m; sourceTree = "<group>"; };
2328+
D09AA5BE1BFDEDD1008CA9EB /* NSString+Attribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Attribute.h"; sourceTree = "<group>"; };
2329+
D09AA5BF1BFDEDD1008CA9EB /* NSString+Attribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Attribute.m"; sourceTree = "<group>"; };
23242330
D09E6AA51BF826AC009D37F8 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
23252331
D09E6AA61BF826AC009D37F8 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
23262332
D09E6AA71BF826AC009D37F8 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
@@ -3259,6 +3265,8 @@
32593265
4E5A66941B268D160007A0AD /* UIView+PressMenu.m */,
32603266
4E0BD8541B6C7DFD0061CAA6 /* UIView+Frame.h */,
32613267
4E0BD8551B6C7DFD0061CAA6 /* UIView+Frame.m */,
3268+
D09AA5BE1BFDEDD1008CA9EB /* NSString+Attribute.h */,
3269+
D09AA5BF1BFDEDD1008CA9EB /* NSString+Attribute.m */,
32623270
);
32633271
path = OC_Category;
32643272
sourceTree = "<group>";
@@ -4748,6 +4756,8 @@
47484756
4E715A311BB1278200A5D24B /* LocalFolderCell.m */,
47494757
4E715A331BB1279D00A5D24B /* LocalFileCell.h */,
47504758
4E715A341BB1279D00A5D24B /* LocalFileCell.m */,
4759+
D09AA5BB1BFDE5F5008CA9EB /* TweetSearchCell.h */,
4760+
D09AA5BC1BFDE5F5008CA9EB /* TweetSearchCell.m */,
47514761
);
47524762
path = Cell;
47534763
sourceTree = "<group>";
@@ -5738,6 +5748,7 @@
57385748
4ECE8AE61A3943E80021E29C /* UILabel+Common.m in Sources */,
57395749
4EA7F15C1A6D192B00A046BD /* SDWebImageDecoder.m in Sources */,
57405750
8E64ED8219ED0CE3006E99DA /* QBImagePickerController.m in Sources */,
5751+
D09AA5BD1BFDE5F5008CA9EB /* TweetSearchCell.m in Sources */,
57415752
4E6BA2E01A1EE6AF005FD721 /* AFURLResponseSerialization.m in Sources */,
57425753
8E59F1031A0120F1009A905F /* CodeFile.m in Sources */,
57435754
4E0BD8801B6C7F0A0061CAA6 /* CSSearchCell.m in Sources */,
@@ -5770,6 +5781,7 @@
57705781
8EF643C819FF7E2900F7EEB0 /* ToMessageCell.m in Sources */,
57715782
4E217F111A70EDC700F6DF88 /* SVWebViewControllerActivityChrome.m in Sources */,
57725783
4E0BD86D1B6C7E3D0061CAA6 /* CSScrollview.m in Sources */,
5784+
D09AA5C01BFDEDD1008CA9EB /* NSString+Attribute.m in Sources */,
57735785
4EE1A2331B5D02CA004284F1 /* ProjectTopicsView.m in Sources */,
57745786
4EA6790D1A1461DC001A0324 /* ProjectFolder.m in Sources */,
57755787
8EF643BC19FF7E2900F7EEB0 /* ProjectActivityListCell.m in Sources */,

Coding_iOS/Controllers/AllSearchDisplayVC.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ typedef NS_ENUM(NSUInteger, eSearchType) {
2323
@interface AllSearchDisplayVC : UISearchDisplayController
2424
@property (nonatomic,weak)UIViewController *parentVC;
2525
@property (nonatomic,assign)eSearchType curSearchType;
26+
-(void)reloadDisplayData;
2627
@end

Coding_iOS/Controllers/AllSearchDisplayVC.m

Lines changed: 67 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#import "RKSwipeBetweenViewControllers.h"
1818
#import "CSHotTopicView.h"
1919
#import "CSMyTopicVC.h"
20-
#import "CSSearchCell.h"
20+
#import "TweetSearchCell.h"
2121
#import "UserInfoViewController.h"
2222
#import "WebViewController.h"
2323
#import "TweetDetailViewController.h"
@@ -44,7 +44,7 @@ @interface AllSearchDisplayVC () <UISearchBarDelegate, UITableViewDelegate, UITa
4444
@property (nonatomic, assign) NSInteger totalCount;
4545
@property (nonatomic, assign) BOOL isLoading;
4646
@property (nonatomic, strong) UILabel *headerLabel;
47-
47+
@property (nonatomic, strong) PublicSearchModel *searchPros;
4848
@property (nonatomic, strong) UIScrollView *searchHistoryView;
4949

5050
- (void)initSubViewsInContentView;
@@ -210,7 +210,7 @@ - (void)initSearchResultsTableView {
210210
UITableView *tableView = [[UITableView alloc] initWithFrame:_contentView.frame style:UITableViewStylePlain];
211211
tableView.backgroundColor = [UIColor whiteColor];
212212
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
213-
[tableView registerClass:[CSSearchCell class] forCellReuseIdentifier:@"CSSearchCell"];
213+
[tableView registerClass:[TweetSearchCell class] forCellReuseIdentifier:@"TweetSearchCell"];
214214
[tableView registerClass:[ProjectAboutMeListCell class] forCellReuseIdentifier:@"ProjectAboutMeListCell"];
215215
tableView.dataSource = self;
216216
tableView.delegate = self;
@@ -383,6 +383,21 @@ - (void)loadMore {
383383
[self requestDataWithPage:_currentPage + 1];
384384
}
385385

386+
-(void)reloadDisplayData{
387+
[self.dateSource removeAllObjects];
388+
switch (_curSearchType) {
389+
case eSearchType_Project:
390+
[self.dateSource addObjectsFromArray:_searchPros.projects.list];
391+
break;
392+
case eSearchType_Tweet:
393+
[self.dateSource addObjectsFromArray:_searchPros.tweets.list];
394+
break;
395+
default:
396+
break;
397+
}
398+
[self.searchTableView reloadData];
399+
}
400+
386401
- (void)requestDataWithPage:(NSInteger)page {
387402

388403
if(page < 1)
@@ -394,43 +409,56 @@ - (void)requestDataWithPage:(NSInteger)page {
394409
_isLoading = YES;
395410

396411
__weak typeof(self) weakSelf = self;
397-
if (_curSearchType==eSearchType_Tweet) {
398-
[[Coding_NetAPIManager sharedManager] requestWithSearchString:self.searchBar.text typeStr:@"tweet" andPage:page andBlock:^(id data, NSError *error) {
399-
400-
if(data) {
401-
NSDictionary *dataDic = (NSDictionary *)data;
402-
weakSelf.currentPage = [[dataDic valueForKey:@"page"] intValue];
403-
weakSelf.totalPage = [[dataDic valueForKey:@"totalPage"] intValue];
404-
weakSelf.totalCount = [[dataDic valueForKey:@"totalRow"] intValue];
405-
NSArray *resultA = [NSObject arrayFromJSON:[dataDic objectForKey:@"list"] ofObjects:@"Tweet"];
406-
[weakSelf.dateSource addObjectsFromArray:resultA];
407-
[weakSelf.searchTableView reloadData];
408-
[weakSelf.searchTableView.infiniteScrollingView stopAnimating];
409-
weakSelf.searchTableView.showsInfiniteScrolling = weakSelf.currentPage >= weakSelf.totalPage ? NO : YES;
410-
}
411-
412-
weakSelf.isLoading = NO;
413-
weakSelf.headerLabel.text = [NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的冒泡", (long)weakSelf.totalCount, weakSelf.searchBar.text, nil];
414-
}];
415-
}else if(_curSearchType==eSearchType_Project){
412+
// if (_curSearchType==eSearchType_Tweet) {
413+
// [[Coding_NetAPIManager sharedManager] requestWithSearchString:self.searchBar.text typeStr:@"tweet" andPage:page andBlock:^(id data, NSError *error) {
414+
//
415+
// if(data) {
416+
// NSDictionary *dataDic = (NSDictionary *)data;
417+
// weakSelf.currentPage = [[dataDic valueForKey:@"page"] intValue];
418+
// weakSelf.totalPage = [[dataDic valueForKey:@"totalPage"] intValue];
419+
// weakSelf.totalCount = [[dataDic valueForKey:@"totalRow"] intValue];
420+
// NSArray *resultA = [NSObject arrayFromJSON:[dataDic objectForKey:@"list"] ofObjects:@"Tweet"];
421+
// [weakSelf.dateSource addObjectsFromArray:resultA];
422+
// [weakSelf.searchTableView reloadData];
423+
// [weakSelf.searchTableView.infiniteScrollingView stopAnimating];
424+
// weakSelf.searchTableView.showsInfiniteScrolling = weakSelf.currentPage >= weakSelf.totalPage ? NO : YES;
425+
// }
426+
//
427+
// weakSelf.isLoading = NO;
428+
// weakSelf.headerLabel.text = [NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的冒泡", (long)weakSelf.totalCount, weakSelf.searchBar.text, nil];
429+
// }];
430+
// }else if(_curSearchType==eSearchType_Project){
431+
// [[Coding_NetAPIManager sharedManager] requestWithSearchString:self.searchBar.text typeStr:@"all" andPage:page andBlock:^(id data, NSError *error) {
432+
// if(data) {
433+
// PublicSearchModel *pros = [NSObject objectOfClass:@"PublicSearchModel" fromJSON:data];
434+
// [weakSelf.dateSource addObjectsFromArray:pros.projects.list];
435+
// [weakSelf.searchTableView reloadData];
436+
// [weakSelf.searchTableView.infiniteScrollingView stopAnimating];
437+
// }
438+
// weakSelf.isLoading = NO;
439+
// weakSelf.headerLabel.text = [NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的项目", (long)weakSelf.totalCount, weakSelf.searchBar.text, nil];
440+
// }];
441+
// }
442+
416443
[[Coding_NetAPIManager sharedManager] requestWithSearchString:self.searchBar.text typeStr:@"all" andPage:page andBlock:^(id data, NSError *error) {
417444
if(data) {
418-
PublicSearchModel *pros = [NSObject objectOfClass:@"PublicSearchModel" fromJSON:data];
419-
420-
// NSArray *resultA = [NSObject arrayFromJSON:[dataDic objectForKey:@"list"] ofObjects:@"Tweet"];
421-
//
422-
[weakSelf.dateSource addObjectsFromArray:pros.projects.list];
445+
_searchPros = [NSObject objectOfClass:@"PublicSearchModel" fromJSON:data];
446+
switch (_curSearchType) {
447+
case eSearchType_Project:
448+
[weakSelf.dateSource addObjectsFromArray:_searchPros.projects.list];
449+
break;
450+
case eSearchType_Tweet:
451+
[weakSelf.dateSource addObjectsFromArray:_searchPros.tweets.list];
452+
break;
453+
default:
454+
break;
455+
}
423456
[weakSelf.searchTableView reloadData];
424457
[weakSelf.searchTableView.infiniteScrollingView stopAnimating];
425-
426-
// NSArray *resultA = [NSObject arrayFromJSON:[dataDic objectForKey:@"list"] ofObjects:@"Tweet"];
427-
// [weakSelf.dateSource addObjectsFromArray:resultA];
428-
// [weakSelf.searchTableView reloadData];
429-
// [weakSelf.searchTableView.infiniteScrollingView stopAnimating];
430-
// weakSelf.searchTableView.showsInfiniteScrolling = weakSelf.currentPage >= weakSelf.totalPage ? NO : YES;
431458
}
459+
weakSelf.isLoading = NO;
460+
weakSelf.headerLabel.text = [NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的项目", (long)weakSelf.totalCount, weakSelf.searchBar.text, nil];
432461
}];
433-
}
434462
}
435463

436464
- (void)analyseLinkStr:(NSString *)linkStr{
@@ -448,7 +476,6 @@ - (void)analyseLinkStr:(NSString *)linkStr{
448476
}
449477

450478

451-
452479
#pragma mark -
453480
#pragma mark UISearchBarDelegate Support
454481

@@ -473,7 +500,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
473500
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
474501

475502
if (_curSearchType==eSearchType_Tweet) {
476-
CSSearchCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CSSearchCell" forIndexPath:indexPath];
503+
TweetSearchCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TweetSearchCell" forIndexPath:indexPath];
477504
cell.selectionStyle = UITableViewCellSelectionStyleNone;
478505
Tweet *tweet = _dateSource[indexPath.row];
479506
cell.tweet = tweet;
@@ -489,14 +516,15 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
489516
[weakSelf analyseLinkStr:curItem.href];
490517
};
491518

492-
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:0];
519+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
493520
return cell;
494521
}else if(_curSearchType==eSearchType_Project){
495522
ProjectAboutMeListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ProjectAboutMeListCell" forIndexPath:indexPath];
523+
cell.openKeywords=TRUE;
496524
Project *project=_dateSource[indexPath.row];
497525
[cell setProject:project hasSWButtons:NO hasBadgeTip:YES hasIndicator:NO];
498526
cell.delegate = self;
499-
// [tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpaceAndSectionLine:kPaddingLeftWidth];
527+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
500528
return cell;
501529
}
502530
else{
@@ -507,7 +535,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
507535
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
508536
if (_curSearchType==eSearchType_Tweet) {
509537
Tweet *tweet = _dateSource[indexPath.row];
510-
return[CSSearchCell cellHeightWithObj:tweet];
538+
return[TweetSearchCell cellHeightWithObj:tweet];
511539
}else if(_curSearchType==eSearchType_Project){
512540
return kProjectAboutMeListCellHeight;
513541
}

Coding_iOS/Controllers/SearchViewController.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#import "CategorySearchBar.h"
1111
#import "KxMenu.h"
1212
#import "AllSearchDisplayVC.h"
13-
1413
@interface SearchViewController ()<UITableViewDataSource,UITableViewDelegate>
1514
@property (nonatomic,strong)UIView *searchView;
1615
@property (strong, nonatomic) NSMutableArray *statusList;
@@ -126,7 +125,6 @@ -(void)buildUI{
126125
});
127126
}
128127

129-
130128
self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(popToMainVCAction)];
131129

132130

@@ -154,6 +152,7 @@ -(void)buildUI{
154152
// }];
155153

156154

155+
157156
}
158157

159158

@@ -189,7 +188,6 @@ -(void)popToMainVCAction
189188
}
190189

191190
- (void)menuItemClicked:(KxMenuItem *)item{
192-
[_mySearchBar becomeFirstResponder];
193191
int nowSelectIndex = [_statusList indexOfObject:item.title];
194192
if (nowSelectIndex == NSNotFound || nowSelectIndex == _selectIndex) {
195193
return;
@@ -199,6 +197,13 @@ - (void)menuItemClicked:(KxMenuItem *)item{
199197
_searchDisplayVC.curSearchType=_selectIndex;
200198
NSString *showStr=([[_statusList objectAtIndex:_selectIndex] length]>2)?[[_statusList objectAtIndex:_selectIndex] substringToIndex:[[_statusList objectAtIndex:_selectIndex] length]-2]:[_statusList objectAtIndex:_selectIndex];
201199
[_mySearchBar setSearchCategory:showStr];
200+
201+
if (_searchDisplayVC.active&&(_mySearchBar.text.length>0)) {
202+
NSLog(@"active And can search");
203+
[_searchDisplayVC reloadDisplayData];
204+
}else{
205+
[_mySearchBar becomeFirstResponder];
206+
}
202207
}
203208

204209

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// NSString+AttributeEmphasize.h
3+
// Coding_iOS
4+
//
5+
// Created by jwill on 15/11/19.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
@interface NSString (AttributeStr)
11+
12+
+(NSAttributedString*)getAttributeFromText:(NSString*)text emphasizeTag:(NSString*)tag emphasizeColor:(UIColor*)color;
13+
+(NSAttributedString*)getAttributeFromText:(NSString*)text emphasize:(NSString*)emphasize emphasizeColor:(UIColor*)color;
14+
15+
16+
@end
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//
2+
// NSString+AttributeEmphasize.m
3+
// Coding_iOS
4+
//
5+
// Created by jwill on 15/11/19.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "NSString+Attribute.h"
10+
11+
@implementation NSString (AttributeStr)
12+
13+
+(NSAttributedString*)getAttributeFromText:(NSString*)text emphasizeTag:(NSString*)tag emphasizeColor:(UIColor*)color{
14+
if (text.length==0) {
15+
return nil;
16+
}
17+
18+
NSString *sepratorStart=[NSString stringWithFormat:@"<%@>",tag];
19+
NSString *sepratorEnd=[NSString stringWithFormat:@"</%@>",tag];
20+
21+
NSMutableString *mutTitle=[[NSMutableString alloc] initWithString:text];
22+
NSMutableAttributedString *resultStr=[NSMutableAttributedString new];
23+
24+
while ([mutTitle rangeOfString:sepratorStart].location!=NSNotFound) {
25+
NSRange startRange=[mutTitle rangeOfString:sepratorStart];
26+
27+
[resultStr appendAttributedString:[[NSMutableAttributedString alloc] initWithString:[mutTitle substringWithRange:NSMakeRange(0,startRange.location)]]];
28+
[mutTitle deleteCharactersInRange:NSMakeRange(0,startRange.location+startRange.length)];
29+
30+
if ([mutTitle rangeOfString:sepratorEnd].location!=NSNotFound) {
31+
NSRange endRange=[mutTitle rangeOfString:sepratorEnd];
32+
NSRange storeRange=NSMakeRange(resultStr.length, endRange.location);
33+
[resultStr appendAttributedString:[[NSMutableAttributedString alloc] initWithString:[mutTitle substringWithRange:NSMakeRange(0,endRange.location)]]];
34+
resultStr=[NSString getAttributeFromText:resultStr range:storeRange emphasizeColor:color];
35+
[mutTitle deleteCharactersInRange:NSMakeRange(0,endRange.location+endRange.length)];
36+
}
37+
}
38+
//尾部
39+
if (mutTitle.length>0) {
40+
[resultStr appendAttributedString:[[NSMutableAttributedString alloc] initWithString:mutTitle]];
41+
}
42+
return resultStr;
43+
}
44+
45+
46+
+(NSAttributedString*)getAttributeFromText:(NSString*)text emphasize:(NSString*)emphasize emphasizeColor:(UIColor*)color{
47+
NSMutableAttributedString *titleColorStr=[[NSMutableAttributedString alloc] initWithString:text];
48+
[titleColorStr addAttribute:NSForegroundColorAttributeName value:color range:[text rangeOfString:emphasize]];
49+
return [titleColorStr copy];
50+
}
51+
52+
53+
+(NSMutableAttributedString*)getAttributeFromText:(NSMutableAttributedString*)text range:(NSRange)range emphasizeColor:(UIColor*)color{
54+
[text addAttribute:NSForegroundColorAttributeName value:color range:range];
55+
return text;
56+
}
57+
58+
@end

Coding_iOS/Views/Cell/ProjectAboutMeListCell.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#import "SWTableViewCell.h"
1818

1919
@interface ProjectAboutMeListCell : SWTableViewCell
20+
@property(nonatomic,assign)BOOL openKeywords;
2021
- (void)setProject:(Project *)project hasSWButtons:(BOOL)hasSWButtons hasBadgeTip:(BOOL)hasBadgeTip hasIndicator:(BOOL)hasIndicator;
2122

2223
@end

0 commit comments

Comments
 (0)