Да, это возможно, установив делегат ( UIAlertViewDelegate ) вашего UIAlertView . Прочитайте сообщение и title из вашего UIAlertView , используя указанные ниже свойства.
@property(nonatomic, copy) NSString *message
@property(nonatomic, copy) NSString *title
Вам необходимо реализовать метод делегата, чтобы получить информацию о том, какая кнопка нажата.
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
Вы также можете перейти по ссылке для получения индекса нажатой кнопки и набрать номер телефона с помощью тел: .
Итак, ваш код может быть примерно таким, как показано ниже.
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
//Access `title` and `message` of your **UIAlertView**
NSString* alertTitle = alertView.title;
NSString* alertMessage = alertView.message;
// Formatted the phone number and assign it to a string.
NSString* myFormattedPhNumber = /*Use StringWithFormat function of NSString */;
if (buttonIndex == 0)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:myFormattedPhNumber];
}
}