How to open Apple Maps with a location and zoom?

2019-08-13 03:50发布

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

标签: ios ios8
0条回答
登录 后发表回答