开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜