// // Service_VC.m // Haishenghai-master // // Created by GG on 2019/1/4. // Copyright © 2019年 Haishenghai intelligence network technology. All rights reserved. // #import "Service_VC.h" #import "Header.h" @interface Service_VC () { UIWebView *callWebview; } @end @implementation Service_VC - (void)viewDidLoad { [super viewDidLoad]; callWebview = [[UIWebView alloc] init]; self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:60/255.0 green:114/255.0 blue:255/255.0 alpha:1]; [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}]; UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [backBtn setImage:[UIImage imageNamed:@"hsh_return"] forState:UIControlStateNormal]; backBtn.frame = CGRectMake(0, 0, 44, 44); [backBtn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside]; backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backBtn]; [self setupUI]; } -(void)backClick{ [self.navigationController popViewControllerAnimated:YES]; } -(void)setupUI{ _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, HEIGHT) style:UITableViewStylePlain]; // _tableView.backgroundColor = [UIColor grayColor]; _tableView.delegate = self; _tableView.dataSource = self; _tableView.userInteractionEnabled = YES; _tableView.showsHorizontalScrollIndicator=NO; _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; [self.view addSubview:_tableView]; } #pragma mark-- tableviewDelegate -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 1; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 70; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *cellId = @"cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; if (!cell) { cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; for (int i =0; i<2; i++) { UILabel *titleLab = [[UILabel alloc]init]; titleLab.frame = CGRectMake(10+(WIDTH-20)*(i/2), 5+(25+5)*(i%2), WIDTH-20, 25); titleLab.tag=i+1; if (titleLab.tag==1) { titleLab.text = [NSString stringWithFormat:@"客服电话:4006005531"]; }else{ titleLab.text = [NSString stringWithFormat:@"工作时间:09:00-18:00(周一至周六)"]; } titleLab.font = [UIFont systemFontOfSize:18]; [cell.contentView addSubview:titleLab]; } UIButton *phoneBtn =[UIButton buttonWithType:UIButtonTypeCustom]; phoneBtn.frame = CGRectMake(WIDTH-54, 13, 44, 44); [phoneBtn setImage:[UIImage imageNamed:@"hsh_user_customer"] forState:UIControlStateNormal]; [cell.contentView addSubview:phoneBtn]; [phoneBtn addTarget:self action:@selector(contectBtnCLick) forControlEvents:UIControlEventTouchUpInside]; return cell; } -(void)contectBtnCLick{ NSString *phone =@"13858080388"; NSMutableString *str=[[NSMutableString alloc] initWithFormat:@"tel:%@",phone]; [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end