//要把整個網址轉碼成UTF8的格式,降子在eventLocationTextField輸入中文到網址中才不會錯
- (IBAction)callWebMap:(id)sender {
NSString* txt = [[NSString alloc] initWithString:self.eventLocationTextField.text];
NSString* query = [NSString stringWithFormat:@"http://maps.apple.com/maps?q=%@",txt];
NSString* strUrl = [query stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL* url = [NSURL URLWithString:strUrl];
[[UIApplication sharedApplication] openURL:url];
[txt release];
[query release];
[strUrl release];
[url release];
}
沒有留言:
張貼留言