我有一个名为“sellPhone”的变量。我想将它添加到URLWithString中。什么是适当的代码?
- (IBAction)buttonCall:(id)sender {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *sellPhone = [defaults objectForKey:@"sellPhone"];
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:@"tel:%",sellPhone]]; //something like this!!!
什么是正确的方法?谢谢!!!
答案 0 :(得分:1)
[NSURL URLWithString:[NSString stringWithFormat:@“tel:%@”,sellPhone]]
在通话结束后返回应用: UIWebView * callWebview = [[UIWebView alloc] init]; NSURL * telURL = [NSURL URLWithString:[NSString stringWithFormat:@“tel:%@”,sellPhone]; [callWebview loadRequest:[NSURLRequest requestWithURL:telURL]];