0

我有一个名为“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!!!

什么是正确的方法?谢谢!!!

4

1 回答 1

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

于 2012-11-07T22:26:46.453 回答