Service_VC.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // Service_VC.m
  3. // Haishenghai-master
  4. //
  5. // Created by GG on 2019/1/4.
  6. // Copyright © 2019年 Haishenghai intelligence network technology. All rights reserved.
  7. //
  8. #import "Service_VC.h"
  9. #import "Header.h"
  10. @interface Service_VC ()<UITableViewDelegate,UITableViewDataSource>
  11. {
  12. UIWebView *callWebview;
  13. }
  14. @end
  15. @implementation Service_VC
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. callWebview = [[UIWebView alloc] init];
  19. self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:60/255.0 green:114/255.0 blue:255/255.0 alpha:1];
  20. [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
  21. UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  22. [backBtn setImage:[UIImage imageNamed:@"hsh_return"] forState:UIControlStateNormal];
  23. backBtn.frame = CGRectMake(0, 0, 44, 44);
  24. [backBtn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
  25. backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  26. self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backBtn];
  27. [self setupUI];
  28. }
  29. -(void)backClick{
  30. [self.navigationController popViewControllerAnimated:YES];
  31. }
  32. -(void)setupUI{
  33. _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, HEIGHT) style:UITableViewStylePlain];
  34. // _tableView.backgroundColor = [UIColor grayColor];
  35. _tableView.delegate = self;
  36. _tableView.dataSource = self;
  37. _tableView.userInteractionEnabled = YES;
  38. _tableView.showsHorizontalScrollIndicator=NO;
  39. _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  40. [self.view addSubview:_tableView];
  41. }
  42. #pragma mark-- tableviewDelegate
  43. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  44. return 1;
  45. }
  46. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  47. return 70;
  48. }
  49. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  50. static NSString *cellId = @"cell";
  51. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
  52. if (!cell) {
  53. cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId];
  54. }
  55. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  56. for (int i =0; i<2; i++) {
  57. UILabel *titleLab = [[UILabel alloc]init];
  58. titleLab.frame = CGRectMake(10+(WIDTH-20)*(i/2), 5+(25+5)*(i%2), WIDTH-20, 25);
  59. titleLab.tag=i+1;
  60. if (titleLab.tag==1) {
  61. titleLab.text = [NSString stringWithFormat:@"客服电话:4006005531"];
  62. }else{
  63. titleLab.text = [NSString stringWithFormat:@"工作时间:09:00-18:00(周一至周六)"];
  64. }
  65. titleLab.font = [UIFont systemFontOfSize:18];
  66. [cell.contentView addSubview:titleLab];
  67. }
  68. UIButton *phoneBtn =[UIButton buttonWithType:UIButtonTypeCustom];
  69. phoneBtn.frame = CGRectMake(WIDTH-54, 13, 44, 44);
  70. [phoneBtn setImage:[UIImage imageNamed:@"hsh_user_customer"] forState:UIControlStateNormal];
  71. [cell.contentView addSubview:phoneBtn];
  72. [phoneBtn addTarget:self action:@selector(contectBtnCLick) forControlEvents:UIControlEventTouchUpInside];
  73. return cell;
  74. }
  75. -(void)contectBtnCLick{
  76. NSString *phone =@"13858080388";
  77. NSMutableString *str=[[NSMutableString alloc] initWithFormat:@"tel:%@",phone];
  78. [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
  79. }
  80. - (void)didReceiveMemoryWarning {
  81. [super didReceiveMemoryWarning];
  82. // Dispose of any resources that can be recreated.
  83. }
  84. /*
  85. #pragma mark - Navigation
  86. // In a storyboard-based application, you will often want to do a little preparation before navigation
  87. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  88. // Get the new view controller using [segue destinationViewController].
  89. // Pass the selected object to the new view controller.
  90. }
  91. */
  92. @end