Minkle Garg
Minkle Garg

Reputation: 751

how to put phone call functionality in iphone application

I am making an application in which there is a text field to enter phone number, now I want whenever user put number on that text field, there must be a button get generate to call on that particular number.

Anyone know about this functionality, then please help me.

Thanks alot.

Upvotes: 0

Views: 1044

Answers (1)

knuku
knuku

Reputation: 6102

Assume self.textField is a UITextField where you can enter the number. Then add the following event listener listener to your 'call' button:

- (IBAction)makeCall{
    NSURL *target = [[[NSURL alloc] initWithString:[NSString stringWithFormat:@"tel:%@", self.textField.text]] autorelease];
    [[UIApplication sharedApplication] openURL:target];    
}

Upvotes: 4

Related Questions