I am using monotouch to create an iOS application using c# code...I'm trying to use the navigation/maps application by using this code:
var addressDictionary = new NSMutableDictionary();
addressDictionary.Add(NSObject.FromObject("Name"), NSObject.FromObject(selectedLocation.Name));
MKPlacemark pMark = new MKPlacemark(new CLLocationCoordinate2D (loc.Latitude, loc.Longitude), null);
MKMapItem mapItem = new MKMapItem(pMark);
mapItem.OpenInMaps();
You are able to create an NSDictionary and pass in information pertaining to the location - like the address, name, etc. However, I don't know how to create and use the dictionary in the c# code - all the coding examples I have found have been objective c...
My whole goal is to open a location in the maps app and pass in the name of a location to be displayed in the placemark in the maps application...using openinmaps()...
Is there any way to create this "address dictionary" using the c# code so that the info is passed into the maps application using the openinmaps function?
Here is an example of some objective c code:
-(void)showMap
{
NSDictionary *address = @{
(NSString *)kABPersonAddressStreetKey: _address.text,
(NSString *)kABPersonAddressCityKey: _city.text,
(NSString *)kABPersonAddressStateKey: _state.text,
(NSString *)kABPersonAddressZIPKey: _zip.text
};
MKPlacemark *place = [[MKPlacemark alloc]
initWithCoordinate:_coords
addressDictionary:address];
MKMapItem *mapItem = [[MKMapItem alloc]initWithPlacemark:place];
NSDictionary *options = @{
MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving
};
[mapItem openInMapsWithLaunchOptions:options];
}