如何启动“Google翻译”应用程序?
答
我不知道用什么谷歌URL方案支持的翻译应用,但你可以使用这个打开iTranslate应用程序 -
要启动应用程序:
NSString *stringURL = @"itranslate://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
要翻译的文字:
NSString *textToTranslate = @"Hello world"; // Text must be URL-encoded...!
textToTranslate = [textToTranslate stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *test = [NSString stringWithFormat:@"itranslate://translate?from=en&to=de&text=%@",textToTranslate];
NSURL *url = [[NSURL alloc] initWithString:test];
[[UIApplication sharedApplication] openURL:url];
+0
谢谢。所以我需要首先知道谷歌翻译的网址方案。 – Joey 2011-05-20 09:04:33
plz精心制作.. – 2011-05-18 05:06:33