这次做一个点击拨打按钮,跳出提示框来,点确定,直接打出电话。当然,模拟器不行的。
-(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]]];
}
}
这样就行了。