|
- //
- // HelpInfoViewController.m
- // goodpk
- //
- // Created by 歐特儀 on 2020/2/11.
- // Copyright © 2020 Altob. All rights reserved.
- //
-
- #import "HelpInfoViewController.h"
-
- @interface HelpInfoViewController ()
- @property (weak, nonatomic) IBOutlet UIButton *helpBtn;
-
- @end
-
- @implementation HelpInfoViewController
-
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- self.title = @"緊急協助";
-
- [self.helpBtn addTarget:self
- action:@selector(handleButtonClicked:)
- forControlEvents:UIControlEventTouchUpInside
- ];
- }
-
- - (void) handleButtonClicked:(id)sender {
-
- [self showAlert:@"重要" :@"確定撥打管理室電話?" :nil];
- }
-
- -(void) callNumber:(NSString *)phoneNum{
-
- NSString *telephoneNumber = phoneNum;
- NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",telephoneNumber];
-
- UIApplication *application = [UIApplication sharedApplication];
- NSURL *URL = [NSURL URLWithString:str];
-
- [application openURL:URL options:@{} completionHandler:^(BOOL success) {
- //OpenSuccess=选择 呼叫 为 1 选择 取消 为0
- //NSLog(@"OpenSuccess=%d",success);
- }];
- }
-
- -(void)showAlert:(NSString *)title :(NSString *)text: (NSInteger *)type{
-
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
- message:text
- preferredStyle:UIAlertControllerStyleAlert ];
-
- UIAlertAction *sinupAction = [UIAlertAction actionWithTitle:@"確定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
- [self callNumber:@"0229647078"];
- }];
- [alertController addAction:sinupAction];
-
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
-
- }];
- [alertController addAction:cancelAction];
-
- [self presentViewController:alertController animated:YES completion:nil];
- }
-
- /*
- #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
|