我正在尝试使用Monotouch学习MapKit,而我很难弄清楚如何搜索地址。我终于找到了这个可能有用的Objective-C代码片段,但它有一行他们使用URL来获取返回值,我不知道如何在C#中使用这段代码:
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv",
[addressField.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
如果有人能给我一些有用的建议。
答案 0 :(得分:4)
这相当于:
string urlString = String.Format(@"http://maps.google.com/maps/geo?q={0}&output=csv", System.Web.HttpServerUtility.UrlEncode(addressField.text))
答案 1 :(得分:0)
对于网址,请尝试此
var uri = new Uri (url);
var nsurl = new NSUrl (uri.GetComponents (UriComponents.HttpRequestUrl, UriFormat.UriEscaped));
UIApplication.SharedApplication.OpenUrl (nsurl);