I开发者_如何学C'm trying to learn the MapKit with Monotouch and I'm having difficulty figuring out how to search for an address. I finally found this snippet of Objective-C code that might help but it has a line where they use a URL to get a return value and I have no idea how to use this code in C#:
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv",
[addressField.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
If anyone could give me some advice that would be helpful.
This is equivalent to:
string urlString = String.Format(@"http://maps.google.com/maps/geo?q={0}&output=csv", System.Web.HttpServerUtility.UrlEncode(addressField.text))
For urls try this
var uri = new Uri (url);
var nsurl = new NSUrl (uri.GetComponents (UriComponents.HttpRequestUrl, UriFormat.UriEscaped));
UIApplication.SharedApplication.OpenUrl (nsurl);
精彩评论