// // MarkViewController.m // tongxin // // Created by ecell on 2021/6/10. // Copyright © 2021 xTT. All rights reserved. // #import "MarkViewController.h" #import "MarkTableViewCell.h" #import "MyUILabel.h" @interface MarkViewController () @property (strong, nonatomic) UITableView *myTableView; @property (strong, nonatomic) NSMutableArray *dataArr; @end @implementation MarkViewController - (void)viewDidLoad { [super viewDidLoad]; _dataArr = [NSMutableArray new]; NSMutableDictionary *dict1 = [[NSMutableDictionary alloc] initWithObjects:@[@"map_icon_sm_GPS",@"卫星定位",@"支持美国GPS、中国北斗两种卫星定位,室外空旷地,最佳定位精度10米左右,但室内定位效果不佳。"] forKeys:@[@"img",@"title",@"content"]]; [_dataArr addObject:dict1]; NSMutableDictionary *dict2 = [[NSMutableDictionary alloc] initWithObjects:@[@"map_icon_sm_wifi",@"Wi-Fi定位",@"设备通过Wi-Fi模块,收集周边的Wi-Fi热点信息,来计算出自身的位置信息,定位的精准度最佳在50米以内。"] forKeys:@[@"img",@"title",@"content"]]; [_dataArr addObject:dict2]; NSMutableDictionary *dict3 = [[NSMutableDictionary alloc] initWithObjects:@[@"map_icon_sm_mohu",@"模糊定位",@"设备通过电信移动运营商的网络(如GSM网),获取自身的位置信息,定位的精准度一般在500米以内。"] forKeys:@[@"img",@"title",@"content"]]; [_dataArr addObject:dict3]; [self initUI]; } - (void)initUI{ self.zx_navTitle = @"定位说明"; _myTableView = [[UITableView alloc] initWithFrame:CGRectMake(16, iPhoneX_NavHeight+12, ScreenWidth-32, ScreenHeight-iPhoneX_NavHeight-12) style:UITableViewStylePlain]; _myTableView.separatorStyle = UITableViewCellSeparatorStyleNone; [_myTableView registerNib:[UINib nibWithNibName:@"MarkTableViewCell" bundle:nil] forCellReuseIdentifier:@"MarkTableViewCell"]; _myTableView.backgroundColor = tabViewBG; _myTableView.delegate = self; _myTableView.dataSource = self; _myTableView.bounces = NO; //禁止弹跳 _myTableView.showsHorizontalScrollIndicator = NO; _myTableView.showsVerticalScrollIndicator = NO; _myTableView.userInteractionEnabled = NO; //去线 //UIView *view = [UIView new]; //view.backgroundColor = [UIColor clearColor]; //[_myTableView setTableFooterView:view]; MyUILabel *footer = [[MyUILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, Adapted(70))]; footer.edgeInsets = UIEdgeInsetsMake(0, 0, 0, 0); footer.font = Font_(12); footer.adjustsFontSizeToFitWidth = YES; footer.numberOfLines = 0; footer.baselineAdjustment = UIBaselineAdjustmentAlignCenters; [footer setTextColor:KKGrey163]; footer.attributedText = [UICommon labelLinesHeight:@"温馨提示:\n定位过程中,设备会根据当时的环境,智能选择最合适的定位方式,用户无须手动选择定位方式。" height:5 align:NSTextAlignmentLeft]; self.myTableView.tableFooterView = footer; [self.view addSubview:_myTableView]; } -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear: animated]; [self.myTableView reloadData]; } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return _dataArr.count; } -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ if (section == 0) { return 0.01; } return 15 * FIX_SCREEN; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 96; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ NSMutableDictionary *data = self.dataArr[indexPath.row]; MarkTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MarkTableViewCell"]; if (!cell) { cell = [[MarkTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"MarkTableViewCell"]; } cell.backgroundColor = KKWhiteColorColor; cell.remarkImg.image = [UIImage imageNamed:data[@"img"]]; cell.remarkType.text = data[@"title"]; cell.remarkContent.attributedText = [UICommon labelLinesHeight:data[@"content"] height:5 align:NSTextAlignmentLeft]; NSLog(@"%@-%@",data[@"title"],data[@"content"]); if (indexPath.row == 0) [UICommon ui_uiViewFillet:CGRectMake(0, 0, ScreenWidth-32, 96) Viewdirection:PYUIdirectionTop toView:cell sizeMake:12]; if (indexPath.row == _dataArr.count-1) [UICommon ui_uiViewFillet:CGRectMake(0, 0, ScreenWidth-32, 96) Viewdirection:PYUIdirectionBotton toView:cell sizeMake:12]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { } - (void) viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; xLog(@"=== MARK viewDidDisappear====") } @end