// // IfishConnectUsViewController.m // Ifish // // Created by wbzhan on 2019/5/23. // Copyright © 2019 lianlian. All rights reserved. // #import "IfishConnectUsViewController.h" @interface IfishConnectUsViewController () Strong UIImageView *codeImage;//二维码 Strong UIButton *telBtn; @end @implementation IfishConnectUsViewController - (void)viewDidLoad { [super viewDidLoad]; self.titleString = @"联系我们"; [self.view addSubview:self.codeImage]; [self.view addSubview:self.telBtn]; [self.codeImage mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(kSizeFrom750(128)); make.width.mas_equalTo(kSizeFrom750(578)); make.height.mas_equalTo(kSizeFrom750(770)); make.centerX.mas_equalTo(self.view); }]; [self.telBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.width.centerX.mas_equalTo(self.codeImage); make.top.mas_equalTo(self.codeImage.mas_bottom).offset(kSizeFrom750(70)); make.height.mas_equalTo(kSizeFrom750(70)); }]; // Do any additional setup after loading the view. } -(UIButton *)telBtn{ if (!_telBtn) { _telBtn = InitObject(UIButton); _telBtn.titleLabel.font = SYSTEMSIZE(34); [_telBtn setTitle:@"服务热线:18667812003" forState:UIControlStateNormal]; [_telBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [_telBtn addTarget:self action:@selector(telBtnClick:) forControlEvents:UIControlEventTouchUpInside]; } return _telBtn; } -(UIImageView *)codeImage { if (!_codeImage) { _codeImage = InitObject(UIImageView); [_codeImage setImage:[UIImage imageNamed:@"code_wechat_us.jpeg"]]; } return _codeImage; } -(void)telBtnClick:(UIButton *)sender{ NSURL *url=[NSURL URLWithString:@"tel://18667812003"]; BOOL canOpen = [[UIApplication sharedApplication] canOpenURL:url]; if (canOpen) { if (@available(iOS 10.0, *)) { /// 大于等于10.0系统使用此openURL方法 [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; }else{ [[UIApplication sharedApplication] openURL:url]; } } } /* #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