VideoFileViewController.mm 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // VideoFileViewController.m
  3. // FunSDKDemo
  4. //
  5. // Created by XM on 2018/11/13.
  6. // Copyright © 2018年 XM. All rights reserved.
  7. //
  8. #import "VideoFileViewController.h"
  9. #import "ByFileViewController.h"
  10. #import "ByTimeViewController.h"
  11. #import "MonthFileViewController.h"
  12. #import "ItemTableviewCell.h"
  13. #import "Header.h"
  14. @interface VideoFileViewController () <UITableViewDelegate,UITableViewDataSource>
  15. {
  16. UITableView *tableV;
  17. NSMutableArray *titleArray;
  18. }
  19. @end
  20. @implementation VideoFileViewController
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. //初始化tableview数据
  24. [self initDataSource];
  25. [self configSubView];
  26. }
  27. #pragma mark - tableView代理方法
  28. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  29. return titleArray.count;
  30. }
  31. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  32. ItemTableviewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ItemTableviewCell"];
  33. if (!cell) {
  34. cell = [[ItemTableviewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ItemTableviewCell"];
  35. }
  36. cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  37. NSString *title = [titleArray objectAtIndex:indexPath.row];
  38. cell.textLabel.text = title;
  39. return cell;
  40. }
  41. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  42. NSString *titleStr = titleArray[indexPath.row];
  43. if ([titleStr isEqualToString:TS("search_by_file")]) {
  44. ByFileViewController *byFileVC = [[ByFileViewController alloc] init];
  45. [self.navigationController pushViewController:byFileVC animated:YES];
  46. }else if ([titleStr isEqualToString:TS("search_by_time")]) {
  47. ByTimeViewController *byTimeVC = [[ByTimeViewController alloc] init];
  48. [self.navigationController pushViewController:byTimeVC animated:YES];
  49. }else if ([titleStr isEqualToString:TS("search_video_date")]) {
  50. MonthFileViewController *monthFileVC = [[MonthFileViewController alloc] init];
  51. [self.navigationController pushViewController:monthFileVC animated:YES];
  52. }
  53. }
  54. #pragma mark - 界面和数据初始化
  55. - (void)configSubView {
  56. [self.view addSubview:self.tableV];
  57. }
  58. - (UITableView *)tableV {
  59. if (!tableV) {
  60. tableV = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight ) style:UITableViewStylePlain];
  61. tableV.delegate = self;
  62. tableV.dataSource = self;
  63. [tableV registerClass:[ItemTableviewCell class] forCellReuseIdentifier:@"ItemTableviewCell"];
  64. }
  65. return tableV;
  66. }
  67. #pragma mark - 界面和数据初始化
  68. - (void)initDataSource {
  69. titleArray = (NSMutableArray*)@[TS("search_by_file"),TS("search_by_time"),TS("search_video_date")];
  70. }
  71. - (void)didReceiveMemoryWarning {
  72. [super didReceiveMemoryWarning];
  73. // Dispose of any resources that can be recreated.
  74. }
  75. @end