chore: import upstream snapshot with attribution
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// TLMobileContactsSearchResultViewController.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/3/8.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLViewController.h"
|
||||
#import "TLSearchResultControllerProtocol.h"
|
||||
|
||||
@interface TLMobileContactsSearchResultViewController : TLViewController <TLSearchResultControllerProtocol>
|
||||
|
||||
@property (nonatomic, strong) NSArray *contactsData;
|
||||
|
||||
@end
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// TLMobileContactsSearchResultViewController.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/3/8.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLMobileContactsSearchResultViewController.h"
|
||||
#import "TLMobileContactsItemCell.h"
|
||||
|
||||
@interface TLMobileContactsSearchResultViewController ()
|
||||
|
||||
@property (nonatomic, strong) UITableView *tableView;
|
||||
|
||||
@property (nonatomic, strong) ZZFLEXAngel *tableViewAngel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLMobileContactsSearchResultViewController
|
||||
|
||||
- (void)loadView
|
||||
{
|
||||
[super loadView];
|
||||
[self setStatusBarStyle:UIStatusBarStyleDefault];
|
||||
|
||||
self.tableView = self.view.addTableView(1)
|
||||
.backgroundColor([UIColor colorGrayBG]).separatorStyle(UITableViewCellSeparatorStyleNone)
|
||||
.tableFooterView([UIView new])
|
||||
.estimatedRowHeight(0).estimatedSectionFooterHeight(0).estimatedSectionHeaderHeight(0)
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(0);
|
||||
})
|
||||
.view;
|
||||
|
||||
self.tableViewAngel = [[ZZFLEXAngel alloc] initWithHostView:self.tableView];
|
||||
}
|
||||
|
||||
- (void)loadListUIWithData:(NSArray *)data
|
||||
{
|
||||
self.tableViewAngel.clear();
|
||||
self.tableViewAngel.addSection(0);
|
||||
self.tableViewAngel.addCells(@"TLMobileContactsItemCell").toSection(0).withDataModelArray(data).selectedAction(^ (id data) {
|
||||
|
||||
});
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
//MARK: UISearchResultsUpdating
|
||||
- (void)updateSearchResultsForSearchController:(UISearchController *)searchController {
|
||||
NSString *searchText = [searchController.searchBar.text lowercaseString];
|
||||
NSMutableArray *data = [[NSMutableArray alloc] init];
|
||||
for (TLMobileContactModel *contact in self.contactsData) {
|
||||
if ([contact.name containsString:searchText] || [contact.pinyin containsString:searchText] || [contact.pinyinInitial containsString:searchText]) {
|
||||
[data addObject:contact];
|
||||
}
|
||||
}
|
||||
[self loadListUIWithData:data];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user