UIAlertController使用 iOS8以上

NSString*phoneNUmber =@"18743047890";

UIAlertController *alertController = [UIAlertControlleralertControllerWithTitle:@"提示"

message:[NSStringstringWithFormat:@"确定拨打: %@ ?", phoneNUmber]

preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction*okAlertAction = [UIAlertActionactionWithTitle:@"确定"

style:UIAlertActionStyleDefault

handler:^(UIAlertAction*_Nonnullaction) {

[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:[NSStringstringWithFormat:@"tel://%@", phoneNUmber]]];

}];

UIAlertAction*cancleAlertAction = [UIAlertActionactionWithTitle:@"取消"

style:UIAlertActionStyleDefault

handler:nil];

[alertControlleraddAction:okAlertAction];

[alertControlleraddAction:cancleAlertAction];

[selfpresentViewController:alertControlleranimated:YEScompletion:nil];

你可能感兴趣的:(UIAlertController使用 iOS8以上)