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