开发者

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 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];    
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜