| @property (nonatomic, strong) UITableView *tableView; | @property (nonatomic, strong) UITableView *tableView; | ||||
| @property (nonatomic, copy) NSArray *datas; | @property (nonatomic, copy) NSArray *datas; | ||||
| @property (nonatomic, copy) NSArray *vcsArray; | |||||
| @end | @end | ||||
| - (void)viewDidLoad { | - (void)viewDidLoad { | ||||
| [super viewDidLoad]; | [super viewDidLoad]; | ||||
| self.datas = @[@"自己写协议走透传",@"有AILink协议自己解析数据",@"集成婴儿秤",@"集成血压计",@"集成身高仪",@"集成遥控器",@"集成额温枪",@"集成温度计",@"集成胎压监测",@"集成体脂秤",@"集成广播秤",@"八电极体脂秤",@"蓝牙WiFi牙刷"]; | |||||
| 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牙刷)" | |||||
| ]; | |||||
| 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] | |||||
| ]; | |||||
| [self.view addSubview:self.tableView]; | [self.view addSubview:self.tableView]; | ||||
| [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { | [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { | ||||
| make.top.left.right.bottom.mas_equalTo(0); | make.top.left.right.bottom.mas_equalTo(0); | ||||
| }]; | }]; | ||||
| } | } | ||||
| -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ | ||||
| return self.datas.count; | return self.datas.count; | ||||
| } | } | ||||
| -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | ||||
| return 50; | return 50; | ||||
| } | } | ||||
| -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | ||||
| static NSString *cellId = @"cellid"; | static NSString *cellId = @"cellid"; | ||||
| UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; | ||||
| } | } | ||||
| cell.textLabel.text = self.datas[indexPath.row]; | cell.textLabel.text = self.datas[indexPath.row]; | ||||
| return cell; | 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]; | |||||
| } | |||||
| -(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{ | -(UITableView *)tableView{ | ||||
| if (_tableView == nil) { | if (_tableView == nil) { | ||||
| _tableView = [[UITableView alloc] init]; | _tableView = [[UITableView alloc] init]; |