你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> iOS 撥打電話的代碼

iOS 撥打電話的代碼

編輯:IOS開發綜合

自己寫的撥打電話的代碼

#pragma mark - telAction
- (void)telAction
{
    // 進入撥打電話頁面
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"服務時間:任務日 09:00-17:30" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:[NSString stringWithFormat:@"呼叫:%@-%@-%@",[kCustomerService substringToIndex:3],[kCustomerService substringWithRange:NSMakeRange(3, 3)],[kCustomerService substringFromIndex:6]] otherButtonTitles:nil];
    actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
    [actionSheet shoWinView:self.view];
}

#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    if (buttonIndex != [actionSheet cancelButtonIndex]) {
        NSString *URLString = [NSString stringWithFormat:@"tel://%@", kCustomerService];
        
        if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:URLString]]) {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:URLString]];
        } else {
            [self toast:@"以後設備中沒有通話功用"];
        }
    }
}


【iOS 撥打電話的代碼】的相關資料介紹到這裡,希望對您有所幫助! 提示:不會對讀者因本文所帶來的任何損失負責。如果您支持就請把本站添加至收藏夾哦!

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved