// // 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" @interface ViewController () @property (nonatomic, strong) UITableView *tableView; @property (nonatomic, copy) NSArray *datas; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.datas = @[@"自己写协议走透传",@"有AILink协议自己解析数据",@"集成婴儿秤",@"集成血压计",@"集成身高仪",@"集成遥控器",@"集成额温枪",@"集成温度计",@"集成胎压监测",@"集成体脂秤",@"集成广播秤",@"八电极体脂秤",@"蓝牙WiFi牙刷"]; [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{ if (indexPath.row == 0) { AiLinkSuperViewController *vc = [[AiLinkSuperViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if (indexPath.row == 1){ InheritScanViewController *vc = [[InheritScanViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if (indexPath.row == 2){ BabyScaleViewController *vc = [[BabyScaleViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if (indexPath.row == 3){ BloodScanViewController *vc = [[BloodScanViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if(indexPath.row == 4){ HeightGuageScanViewController *vc = [[HeightGuageScanViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if(indexPath.row == 5){ RemoteControlScanViewController *vc = [[RemoteControlScanViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if(indexPath.row == 6){ ForeheadScanViewController *vc = [[ForeheadScanViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if(indexPath.row == 7){ ThermometerScanViewController *vc = [[ThermometerScanViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if(indexPath.row == 8){ WheelMonitorScanViewController *vc = [[WheelMonitorScanViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if(indexPath.row == 9){ BodyFatScaleScanViewController *vc = [[BodyFatScaleScanViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if(indexPath.row == 10){ BroadcastScaleViewController *vc = [[BroadcastScaleViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if (indexPath.row == 11){ EightScaleScanViewController *vc = [[EightScaleScanViewController alloc] init]; vc.title = self.datas[indexPath.row]; [self.navigationController pushViewController:vc animated:YES]; }else if (indexPath.row == 12){ ToothbrushScanViewController *vc = [[ToothbrushScanViewController alloc] init]; 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