I am making an application in which there is a text field to enter phone number, now I w开发者_运维问答ant 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.
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];
}
精彩评论