开发者

how to put phone call functionality in iphone application

开发者 https://www.devze.com 2023-03-09 13:07 出处:网络
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 t

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

精彩评论

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

关注公众号