Brandon
Brandon

Reputation: 889

MKCoordinateRegionForMapRect unavailable in monotouch?

I am converting an example from Objective-C to c# and it used MKCoordinateRegionForMapRect. I am not able to find the equivilent in MonoTouch. Can someone help?

Upvotes: 1

Views: 157

Answers (1)

poupou
poupou

Reputation: 43553

The pinvoke for this function is (presently) missing from MonoTouch. Based on the documentation [1] the right pinvoke should look like:

[DllImport (Constants.MapKitLibrary, EntryPoint="MKCoordinateRegionForMapRect")]
extern static public MKCoordinateRegion FromMapRect (MKMapRect rect);

Add this into your code (inside a type and with the right 'using' namespaces) and it should work fine :-)

[1] http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MapKitFunctionsReference/Reference/reference.html

UPDATE: Newer MonoTouch releases have this new method (MonoTouch 4.2.x+)

Upvotes: 1

Related Questions