How to open Apple Maps with a location and zoom?

主宰稳场 提交于 2019-12-13 00:56:33

问题


The following code will open Apple maps (iOS8) at the correct location "mapLocation", but the option MKLaunchOptionsMapSpanKey seems to be ignored. The map view is always about 250m across on a portrait iPhone, regardless of the settings in span. The values for MKCoordinateSpan span latitude/longitudeDelta I've tested are in the range 0.3-2 degrees. How do I get the zoom level I want?

        MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:mapLocation addressDictionary:nil];
        MKMapItem *item = [[MKMapItem alloc] initWithPlacemark:placemark];
        item.name = pointID;
        options = @{MKLaunchOptionsMapSpanKey:[NSValue valueWithMKCoordinateSpan:span],
                    MKLaunchOptionsMapTypeKey:[NSNumber numberWithInteger:MKMapTypeHybrid]};

        [item openInMapsWithLaunchOptions:options];

来源:https://stackoverflow.com/questions/28121850/how-to-open-apple-maps-with-a-location-and-zoom

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!