开发者

MKCoordinateRegionForMapRect unavailable in monotouch?

开发者 https://www.devze.com 2023-03-27 10:00 出处:网络
I am converting an example from Objective-C to c# and it used MKCoordinateRegionForMapRect. I am not able to find the equ开发者_高级运维ivilent in MonoTouch. Can someone help? The pinvoke for this fun

I am converting an example from Objective-C to c# and it used MKCoordinateRegionForMapRect. I am not able to find the equ开发者_高级运维ivilent in MonoTouch. Can someone help?


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+)

0

精彩评论

暂无评论...
验证码 换一张
取 消