mkmapview

Keep MKMapSnapshotter as NSData in memory - Swift

限于喜欢 提交于 2019-12-12 14:52:43
问题 I'm trying to take a screenshot of my MKMapView. I usually achieved this using the below code in Objective C. I'm wondering how I would keep the NSData object in memory, rather than saving the image, and then reading from it straight away. I'm also wondering how this could be written in Swift - In particular, the completion handler part. I've looked at the docs - but unsure of syntax:https://developer.apple.com/library/prerelease/iOS/documentation/MapKit/Reference/MKMapSnapshotter_class/index

Rotate annotation image on MKMapView

时光总嘲笑我的痴心妄想 提交于 2019-12-12 14:26:21
问题 I am trying to rotate an image that is added to MKMapView as an annotation. This is the code: -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation: (id<MKAnnotation>)annotation { if (! [annotation isKindOfClass:[IGAMapAnnotation class]]) { //return default view if annotation is NOT of type IGAMapAnnotation... return nil; } MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"IGAMapAnnotation"]; if (annotationView == nil) { annotationView = [

Apple Map (MKMapView) Mercator Projection's EPSG

我的梦境 提交于 2019-12-12 13:32:07
问题 I can't seem to find which projection Apple Map's Mercator Projection uses. Doesn't say on their guide: Location Awareness Guide Anybody know off hand? 回答1: It's the same as Google's, which EPSG:3857 (and unofficially 900913). 来源: https://stackoverflow.com/questions/16575006/apple-map-mkmapview-mercator-projections-epsg

MKMapView dealloc'ed when calling addOverlay

匆匆过客 提交于 2019-12-12 13:14:09
问题 I'm having an issue with my mapView being dealloced when I call this in - (void)viewDidLoad NSString *template = @"http://tile.openstreetmap.org/{z}/{x}/{y}.png"; self.onlineOverlay = [[MKTileOverlay alloc] initWithURLTemplate:template]; self.onlineOverlay.canReplaceMapContent = YES; [_mapView addOverlay:self.onlineOverlay level:MKOverlayLevelAboveLabels]; The log is:(with zombie objects enabled) *** -[VKRasterOverlayTileSource invalidateRect:level:]: message sent to deallocated instance

Observing the region of MKMapView via KVO?

懵懂的女人 提交于 2019-12-12 12:13:30
问题 I have an object that is interested in knowing when the region of a MKMapView is changed. This object is not the delegate of the map view, however. I'm trying the following, where map is a MKMapView: [map addObserver:self forKeyPath:@"region" options:0 context:nil]; However, observeValueForKeyPath:ofObject:change:context: isn't being called back. As an interim solution, I have the map's delegate letting this other object know when the map region is changed, but I'd like to uncouple the two

How to change Apple Map (MKMapView) background colors?

ⅰ亾dé卋堺 提交于 2019-12-12 11:24:50
问题 I've Required an iOS application with a black theme, and would really like to make the displayed Apple Map also in black colors. I see nothing in the native documentation that talks about changing look for MKMapView. I've Googled the topic and tried to change MKOverlayView.But, I couldn't find anything. Is this even possible? Can I change the background colors of the Apple Map. Thank you. 回答1: You can customize map using MapBoxKit https://www.mapbox.com/ios-sdk/api/3.6.4/runtime-styling.html

Selecting a MapView Annotation Twice

风格不统一 提交于 2019-12-12 10:58:58
问题 My iPhone app has a mapview with a large number of locations that the user can select from. I would like him to be able to tap on one of the annotations to display its callout view, and then again to actually select it. The problem is that the didSelectAnnotationView only gets called once. So how can I detect the selection an already selected annotation? Alternatively, how can I deselect an annotation without hiding the callout view? The user can work round this by deselecting the annotation

Trouble with overlay using MKPolyline & MKPolylineView

流过昼夜 提交于 2019-12-12 10:09:47
问题 I have added an overlay to my MKMapView using the addOverlay: method. The overlay was made using MKPolyline and stroked using MKPolylineView. The stroke color is blue, with an alpha value of 0.7. When the view initially loads, the overlay is drawn correctly but the surrounding areas of the overlay are blue as well... When I pinch & zoom out, the blue area is still there but it adjusts to my new zoom level. This is somewhat hard to describe... but basically I have a small rectangle of "normal

mapViewDidFailLoadingMap delegate method gets called with error == 0

▼魔方 西西 提交于 2019-12-12 10:03:59
问题 In my viewcontroller, I create a MKMapView object. I set the delegate to self, and in the ViewController, I implemented: - (void)mapViewDidFailLoadingMap:(MKMapView *)mapView withError:(NSError *)error This method gets called, but in the debugger, I see that error has the value 0x0 This happens on the device, and in the simulator. I need the error code, as I want to give a message for the case where internet access is unavailable, while ignoring the cases like (from the API doc) "if a request

How to Show Multiple Annotation in MKMapView iOS?

試著忘記壹切 提交于 2019-12-12 09:45:48
问题 i am newbie in iOS Development i want to Show multiple Annotation in MKMapViewController in iOS for that i write a code as in my viewDidLoad method - (void)viewDidLoad { [super viewDidLoad]; self.mapView.delegate=self; NSArray *name=[[NSArray alloc]initWithObjects: @"VelaCherry", @"Perungudi", @"Tharamani", nil]; self.annotation=[[NSMutableArray alloc]initWithCapacity:[name count]]; MKPointAnnotation *mappin=[[MKPointAnnotation alloc]init]; CLLocationCoordinate2D location; location.latitude=