RDSSelectDeviceSubVC.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // RDSSelectDeviceSubVC.m
  3. // Temperature
  4. //
  5. // Created by 姓二名哈字富贵儿 on 2023/8/17.
  6. //
  7. #import "RDSSelectDeviceSubVC.h"
  8. @interface RDSSelectDeviceSubVC () <UITableViewDelegate, UITableViewDataSource>
  9. @property (nonatomic, strong) UITableView *tableView;
  10. @property (nonatomic, strong) NSArray *dataSource;
  11. @end
  12. @implementation RDSSelectDeviceSubVC
  13. - (void)viewDidLoad {
  14. [super viewDidLoad];
  15. [self configSubviews];
  16. }
  17. - (void)configSubviews {
  18. self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
  19. self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  20. self.tableView.rowHeight = 110;
  21. self.tableView.delegate = self;
  22. self.tableView.dataSource = self;
  23. [self.view addSubview:self.tableView];
  24. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.left.right.bottom.equalTo(self.view);
  26. make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
  27. }];
  28. }
  29. - (void)reloadDataWithDataSource:(NSArray *)dataSource {
  30. if (!dataSource) {
  31. self.dataSource = [NSMutableArray array];
  32. return;
  33. }
  34. self.dataSource = [dataSource copy];
  35. [self.tableView reloadData];
  36. }
  37. #pragma mark - UITableViewDataSource
  38. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  39. return self.dataSource.count;
  40. }
  41. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  42. return 1;
  43. }
  44. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  45. return [[UITableViewCell alloc] init];
  46. }
  47. @end