ContactResultVC.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // ContactResultVC.m
  3. // LN_School
  4. //
  5. // Created by EchoShacolee on 2017/6/28.
  6. // Copyright © 2017年 Danson. All rights reserved.
  7. //
  8. #import "ContactResultVC.h"
  9. #import "ContactDetailVC.h"
  10. @interface ContactResultVC ()
  11. @end
  12. @implementation ContactResultVC
  13. - (void)viewDidLoad {
  14. [super viewDidLoad];
  15. self.tableView.tableFooterView = [UIView new];
  16. __weak typeof(self) weakSelf = self;
  17. self.reloadBlock = ^{
  18. [weakSelf.tableView reloadData];
  19. };
  20. }
  21. - (void)didReceiveMemoryWarning {
  22. [super didReceiveMemoryWarning];
  23. // Dispose of any resources that can be recreated.
  24. }
  25. #pragma mark - Table view data source
  26. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  27. return 1;
  28. }
  29. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  30. return self.dataSource.count;
  31. }
  32. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  33. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID"];
  34. if (!cell) {
  35. cell = [[UITableViewCell alloc]initWithStyle:0 reuseIdentifier:@"cellID"];
  36. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  37. }
  38. if(_dataSource[indexPath.row][0]){
  39. cell.textLabel.text = _dataSource[indexPath.row][0];
  40. }else{
  41. cell.textLabel.text = @"";
  42. }
  43. return cell;
  44. }
  45. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  46. if (self.pushBlock) {
  47. self.pushBlock(_dataSource[indexPath.row]);
  48. }
  49. }
  50. -(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
  51. if (self.scrollBlock) {
  52. self.scrollBlock();
  53. }
  54. }
  55. @end