// // ViewController.m // AILinkBleSDKSourceCode // // Created by iot_user on 2020/4/7. // Copyright © 2020 IOT. All rights reserved. // #import "ViewController.h" #import "Masonry.h" #import "AiLinkSuperViewController.h" #import "InheritScanViewController.h" #import "BabyScaleViewController.h" #import "BloodScanViewController.h" #import "HeightGuageScanViewController.h" #import "RemoteControlScanViewController.h" #import "ForeheadScanViewController.h" #import "ThermometerScanViewController.h" #import "WheelMonitorScanViewController.h" #import "BodyFatScaleScanViewController.h" #import "BroadcastScaleViewController.h" #import "EightScaleScanViewController.h" #import "ToothbrushScanViewController.h" #import "ELBfsWifiScanVC.h" @interface ViewController () @property (nonatomic, strong) UITableView *tableView; @property (nonatomic, copy) NSArray *datas; @property (nonatomic, copy) NSArray *vcsArray; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.datas = @[ @"Parse data yourself(有AILink协议自己解析数据)", @"Baby Scale(婴儿秤)", @"Sphygmomanometer(血压计)", @"Height Guage(身高仪)", @"Remote Control(遥控器)", @"Forehead thermometer(额温枪)", @"Digital thermometer(温度计)", @"TPMS(胎压监测)", @"Bluetooth BodyfatScale(体脂秤)", @"Bluetooth BroadcastScale(广播秤)", @"Eight-electrode scale(八电极体脂秤)", @"wifi-ble toothbrush(WiFi-ble牙刷)", @"wifi-ble bodyfatScale(WiFi-ble体脂秤)", ]; self.vcsArray = @[ [[InheritScanViewController alloc] init], [[BabyScaleViewController alloc] init], [[BloodScanViewController alloc] init], [[HeightGuageScanViewController alloc] init], [[RemoteControlScanViewController alloc] init], [[ForeheadScanViewController alloc] init], [[ThermometerScanViewController alloc] init], [[WheelMonitorScanViewController alloc] init], [[BodyFatScaleScanViewController alloc] init], [[BroadcastScaleViewController alloc] init], [[EightScaleScanViewController alloc] init], [[ToothbrushScanViewController alloc] init], [[ELBfsWifiScanVC alloc] init], ]; [self.view addSubview:self.tableView]; [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.left.right.bottom.mas_equalTo(0); }]; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return self.datas.count; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 50; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *cellId = @"cellid"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; if (!cell) { cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId]; } cell.textLabel.text = self.datas[indexPath.row]; return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ UIViewController *vc = self.vcsArray[indexPath.row]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; } -(UITableView *)tableView{ if (_tableView == nil) { _tableView = [[UITableView alloc] init]; _tableView.delegate = self; _tableView.dataSource = self; } return _tableView; } @end