Pawan Sharma
Pawan Sharma

Reputation: 3334

To get Dialing screen to appear on clicking a button in iPhone app

I have got a requirement in my app which is that- On clicking a button we have to make dialing screen (calling screen) to appear as next view. Is this possible to do so? Please suggest me the way how can I do so?

Upvotes: 0

Views: 1096

Answers (3)

Pawan Sharma
Pawan Sharma

Reputation: 3334

For further reader of this question two app in iOS can interact the tutorial shows a demo how this can be done with the URL scheme in iOS.

Upvotes: 0

edzio27
edzio27

Reputation: 4140

It is not possible to open a dialing screen as a new view. You can only leave your program and open default iphone dialog screen as a new process (your application will be in the background in this moment). To do this use this code to dial number:

NSURL *phoneURL = [NSURL URLWithString:@"tel:12342333"];
[[UIApplication sharedApplication] openURL:phoneURL]]; 

Upvotes: 2

Ulaş Sancak
Ulaş Sancak

Reputation: 907

For example in your action button block:

NSMutableString *phone = [[@"+ 12 34 567 89 01" mutableCopy] autorelease];
[phone replaceOccurrencesOfString:@" " 
                       withString:@"" 
                          options:NSLiteralSearch 
                            range:NSMakeRange(0, [phone length])];
[phone replaceOccurrencesOfString:@"(" 
                       withString:@"" 
                          options:NSLiteralSearch 
                            range:NSMakeRange(0, [phone length])];
[phone replaceOccurrencesOfString:@")" 
                       withString:@"" 
                          options:NSLiteralSearch 
                            range:NSMakeRange(0, [phone length])];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", phone]];
[[UIApplication sharedApplication] openURL:url];

Upvotes: 0

Related Questions