MKCoordinateRegionForMapRect在monotouch中不可用

本文关键字:monotouch MKCoordinateRegionForMapRect | 更新日期: 2023-09-27 18:05:15

我正在将一个例子从Objective-C转换为c#,它使用了MKCoordinateRegionForMapRect。我无法在MonoTouch中找到相应的设备。有人能帮忙吗?

MKCoordinateRegionForMapRect在monotouch中不可用

这个函数的pinvoke(目前)在MonoTouch中缺失。根据文档[1],正确的pinvoke应该是这样的:

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

将此添加到代码中(在类型中并使用正确的'using'命名空间),它应该工作正常:-)

[1] http://developer.apple.com/library/ios/文档/地/引用/MapKitFunctionsReference/引用/reference.html

UPDATE:较新的MonoTouch版本有这个新方法(MonoTouch 4.2.x+)