這次做一個(gè)點(diǎn)擊撥打按鈕,跳出提示框來(lái),點(diǎn)確定,直接打出電話。當(dāng)然,模擬器不行的。
-(void)xxxxx{
//在線客服
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:TELEPHONE_NUM message:@"是否撥打客服電話" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"確定", nil];
alertView.delegate = self;
[alertView show];
};
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"+++++++++++++%ld",(long)buttonIndex);
if (buttonIndex==1) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@", TELEPHONE_NUM]]];
}
}
這樣就行了。