mkmapsnapshotter

MKMapSnapshotOptions : Adding snapshot of Custom Pin Annotation View or UIView

丶灬走出姿态 提交于 2019-12-03 07:18:36
I am trying to get snapshot of map view with startWithCompletionHandler methods of MKMapSnapshotter. and I want to add Custom Pin Annotation View to snap shot. and there is a label in my custom annotation view. so I can not show that label when ı am getting snapshot. here is the code: let snapshotter = MKMapSnapshotter(options: options) snapshotter.startWithCompletionHandler() { snapshot, error in if error != nil { completion(image: nil, error: error) return } let image = snapshot.image let pin = MKPinAnnotationView(annotation: nil, reuseIdentifier: "") // I want to use custom annotation view

VectorKit crash reports with MKMapSnapshotter on iOS

不羁岁月 提交于 2019-12-03 00:54:02
I'm getting different kind of crash reports related to VectorKit and MKMapSnapShotter . Crashes occur pretty random, but it seems like they happen most when returning from the background. The device does not send out any memory warnings before it happens. What's happening here? I'm using: if (!_snapshotQueue) { _snapshotQueue = dispatch_queue_create("com.bestappever.snapshot", DISPATCH_QUEUE_SERIAL); } [_snapshotter cancel] _snapshotter = [[MKMapSnapshotter alloc] initWithOptions:options]; __weak __typeof(self)__self = self; [_snapshotter startWithQueue:queue completionHandler:^(MKMapSnapshot

Creating an MKMapSnapshotter with an MKPolylineRenderer

╄→尐↘猪︶ㄣ 提交于 2019-12-01 03:03:06
I thought iOS 7's MKMapSnapshotter s would be a simple way to take a snapshot of an MKMapView , the benefit is that you can do it without loading the map into view. Even though it seems like more work to add pins and overlays (because of the need for core graphics). The WWDC videos give a very good example of creating an MKMapSnapshotter with adding an MKAnnotationView . However, for someone with not a lot of core graphics experience it's not really obvious how you create an MKMapSnapshotter from an MKPolylineRenderer . I have tried to do this, but the path is inaccurate. It draws about 10% of

Creating an MKMapSnapshotter with an MKPolylineRenderer

♀尐吖头ヾ 提交于 2019-11-30 22:56:10
问题 I thought iOS 7's MKMapSnapshotter s would be a simple way to take a snapshot of an MKMapView , the benefit is that you can do it without loading the map into view. Even though it seems like more work to add pins and overlays (because of the need for core graphics). The WWDC videos give a very good example of creating an MKMapSnapshotter with adding an MKAnnotationView . However, for someone with not a lot of core graphics experience it's not really obvious how you create an MKMapSnapshotter

Swift 3 Add custom annotation pin to MKMapSnapShotter snapshot

痴心易碎 提交于 2019-11-30 13:57:56
I'm learning Swift 3 on my own, and my current learning project involves allowing the user to snap a photo and get a map snapshot with the current location pinned. I've relied on this answer from Aug 2015 and this answer from Jun 2016 for guidance, but I still can't find the right path. Right now, I can... Get the photo from the buffer Get a map snapshot But I just can't place the pin. I know that my code is incomplete and ineffective -- so this is more than just a debugging question. Here is what I've been working with (as well as many variations based on the links above): let snapShotter =

iOS MKMapShapshotter completion block is not always being called

纵饮孤独 提交于 2019-11-29 13:43:42
I am trying to use the new iOS7 MKMapSnapshotter to generate a static map image. Whenever my app needs a map, I call the following: MKMapSnapshotter *snapshotter = [[[MKMapSnapshotter alloc] initWithOptions:theOptions] autorelease]; dispatch_queue_t aQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0); DebugLog(@"Snapshotter allocated %@ and run on queue %@", snapshotter, aQueue); [snapshotter startWithQueue:aQueue completionHandler:^(MKMapSnapshot *snapshot, NSError *error) { DebugLog(@"Snapshotter completion block %@", snapshotter); // perform selector on main thread to

How to determine the correct altitude for an MKMapCamera focusing on an MKPolygon

◇◆丶佛笑我妖孽 提交于 2019-11-29 07:17:49
I need to figure out how to set up MKMapSnapshotterOptions to take a snapshot of aerial/satellite imagery associated with a polygonal region of the earth. Filling out the 'region', 'scale', 'size', and 'mapType' properties are trivial, as I have an MKPolygon to work with. The tricky part is in setting the 'camera' -- in my particular case, I am using MKMapSnapshotter independently of the MKMapView (in fact, not even on the main thread). However, I would prefer to orient the snapshot so that it fits the bounds of the polygon based on a non-zero heading -- that is, the area that I am taking a

How to determine the correct altitude for an MKMapCamera focusing on an MKPolygon

我的梦境 提交于 2019-11-28 00:44:27
问题 I need to figure out how to set up MKMapSnapshotterOptions to take a snapshot of aerial/satellite imagery associated with a polygonal region of the earth. Filling out the 'region', 'scale', 'size', and 'mapType' properties are trivial, as I have an MKPolygon to work with. The tricky part is in setting the 'camera' -- in my particular case, I am using MKMapSnapshotter independently of the MKMapView (in fact, not even on the main thread). However, I would prefer to orient the snapshot so that

Snapshot of MKMapView in iOS7

纵然是瞬间 提交于 2019-11-27 06:06:50
I am trying to create a snapshot of a MKMapView in iOS7 application the same way it's recommended everywhere for previous iOS versions: - (UIImage*) renderMapViewToImage { UIGraphicsBeginImageContextWithOptions(mapView.frame.size, NO, 0.0); [mapView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } However, the image returned is a black rectangle with a blue current location dot on top of it. I've tried using different sublayers of the mapView as well, but the result is always the

Snapshot of MKMapView in iOS7

你离开我真会死。 提交于 2019-11-26 11:53:35
问题 I am trying to create a snapshot of a MKMapView in iOS7 application the same way it\'s recommended everywhere for previous iOS versions: - (UIImage*) renderMapViewToImage { UIGraphicsBeginImageContextWithOptions(mapView.frame.size, NO, 0.0); [mapView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } However, the image returned is a black rectangle with a blue current location dot on