mapkit

Subclassing MKAnnotationView and overriding setDragState

本小妞迷上赌 提交于 2019-11-27 08:08:20
This is about an iPhone App using MKMapKit: I created a custom MKAnnotationView for a draggable Annotation. I want to create a custom animation. I set a custom pin image and the annotation is draggable (which both is not shown here, it happens in the mapview) with the following code: - (void) movePinUpFinished { [super setDragState:MKAnnotationViewDragStateDragging]; [self setDragState:MKAnnotationViewDragStateDragging]; } - (void) setDragState:(MKAnnotationViewDragState) myState { if (myState == MKAnnotationViewDragStateStarting) { NSLog(@"starting"); CGPoint endPoint = CGPointMake(self

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

How can I group MKAnnotations automatically regarding zoom level?

孤街醉人 提交于 2019-11-27 05:29:54
问题 if the user zooms out on a MKMapView, i want MKAnnotations which are near to each other automatically grouped into one "group" annotation. if the user zooms back in, the "group" annotation should be split again to the unique/original annotations. apple does this already in the iOS 4 Photos.app is there a common, "predefined" way to do this? 回答1: Its normal working with more than 1500 annotations on the map: -(void)mapView:(MKMapView *)mapView_ regionDidChangeAnimated:(BOOL)animated {

Map view annotations with different pin colors

送分小仙女□ 提交于 2019-11-27 05:29:10
I have an array with over 200 objects and I am trying to perform a loop through each of them. Each object will have a yes/no field and I want to display a different coloured marker dependent on that yes / no value. From what I can see is happening my loop is going through each object first and then all the annotation is added at the end for each object . Since I perform a check within my loop through the array on the yes no value when all the annotation is added to my map, it will use the yes/no value from the last object in the array when it goes to plot for all. How can I have it so that the

How to open call out MKAnnotationView programmatically? (iPhone, MapKit)

人走茶凉 提交于 2019-11-27 05:25:11
问题 I want to open up the callout for an MKPinAnnotationView programmatically. Eg I drop 10 pins on the map, and want to open up the one closest to me. How would I go about doing this? Apple has specified the 'selected' parameter for MKAnnotationView's , but discourages setting it directly (this doesn't work, tried it). For the rest MKAnnotationView only has a setHighlighted ( same story ), and can ShowCallout method.. Any hints if this is possible at all? 回答1: In your mapViewController create an

Should I be worried about rumors that Apple will stop using Google Maps in iOS6? [closed]

怎甘沉沦 提交于 2019-11-27 04:44:48
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Almost every major news media outlet is reporting that Apple will stop using Google Maps services in iOS6. I don't think anyone really

iOS Mapkit Custom Callout

。_饼干妹妹 提交于 2019-11-27 04:35:52
问题 Here's a sample custom callout that I'd want to get a similar style of. I was thinking of inheriting from MKAnnotation but I'm lost how to start it and I don't know if the callout's design could be overridden. Any ideas how to implement this custom callout with ui controls inside? EDIT: Here's my code from following the similar StackOverflow answer: - (MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isKindOfClass:

Stuck on using MKPinAnnotationView() within Swift and MapKit

拟墨画扇 提交于 2019-11-27 04:33:42
问题 I have a working loop to setup annotations for the title and subtitle elements for some working data points. What I want to do within that same loop structure is to set the pin color to Purple instead of the default. What I can't figure out is what I need to do to tap into my theMapView to set the pin accordingly. My working loop and some attempts at something... .... for var index = 0; index < MySupplierData.count; ++index { // Establish an Annotation myAnnotation = MKPointAnnotation(); ...

How to define the order of overlapping MKAnnotationViews?

烂漫一生 提交于 2019-11-27 04:21:41
I have several MKAnnotations (and their corresponding views) in my map, and it sometimes gets really crowded. Now, the annotations in my app come in two flavors: some are bound to stay where they are, while others will move as time goes on. I'd prefer to have the more stable ones visually in the background and the moving ones to always pass in front of them. One would think, perhaps, that the annotations most recently added to the map would end up to the front (or alternatively at the very back, at least) but this just doesn't seem to be the rule. As far as I can tell, I create and add ALL the

Centering MKMapView on spot N-pixels below pin

北城余情 提交于 2019-11-27 03:50:12
Want to center MKMapView on a point N-pixels below a given pin ( which may or may not be visible in the current MapRect ). I've been trying to solve this using various plays with -(CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view to no success. Anyone been down this road ( no pun intended )? The easiest technique is to just shift the map down, say 40% from where the coordinate would be, taking advantage of the span of the region of the MKMapView . If you don't need actual pixels, but just need it to move down so that the CLLocationCoordinate2D in question