mkannotation

How to stop the viewForAnnotation method from overriding the default user location blue beacon in iOS

时光毁灭记忆、已成空白 提交于 2019-12-18 12:15:23
问题 Right now I am populating a map view with annotations, and also displaying the user's current location. With the viewForAnnotation method, it overrides all annotations with the default red pin, but I want to return the views for the other annotations, but keep the user location the default blue beacon. Is there a way to do this simply or do I have to create a new annotation view and return the right one depending on the annotation? Right now I have something like: - (MKAnnotationView *

Warning in Custom Map Annotations iPhone

谁说我不能喝 提交于 2019-12-17 16:29:23
问题 I am using a custom map annotation class for map view in iPhone. Whenever I pop my map view from navigation bar stack I usually see some warnings in console. MapAnnotation was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info: I am not using KVO in my code hence not able to

MKMapView annotations changing/losing order?

北城余情 提交于 2019-12-17 06:52:13
问题 I have a map view with annotations, and these annotations display a callout. When the callout's disclosure detail button is clicked, it segues into a new view. My MKAnnotations are a custom class that implements <MKAnnotation> . Let's call that class MyClass. They are stored in an NSMutableArray. During viewdidload of this view, I add each object of MyClass in this array to the map view's annotations. Using the debugger, I can see that once all of this adding is done, the [self.MapView

MKMapView removeAnnotation is not removing the selected annotation

自古美人都是妖i 提交于 2019-12-14 01:52:45
问题 When I call removeAnnotation and pass it a pointer to the annotation I had added, it is not removing the annotation... Is this because it had made a copy of the annotation when I added it? Thanks Deshawn 回答1: You could try this nsarray *oldAnnotations=[self.mapview annotations]; [self.mapview removeAnnotations:oldAnnotations]; 来源: https://stackoverflow.com/questions/6876662/mkmapview-removeannotation-is-not-removing-the-selected-annotation

Creating a dynamic MKAnnotationView in Swift

只愿长相守 提交于 2019-12-13 19:01:52
问题 Currently, I know how to create a MKAnnotationView with a static pin, an image that's added. Does anyone know, or have any resources, on how to create a pin that would change colors or have a number displayed inside of it that would change depending on information about the business? For instance, I would like to have a pin be red when the business is closed, and green when the business is open. Maybe even a dollar signs inside of the pin to tell the user how expensive it is. EDIT I have

Xcode Annotation from Property List

跟風遠走 提交于 2019-12-13 07:37:08
问题 i know that similar questions have been already asked, but i just could find the answer. So, I'm building an app that has over 100 Pins, writing it into the implementation would be just to much. Does anybody know from your previous experience how can i use the property list file to store coordinates and then read them and place Pins on my map ? What is the best way to do this because i did work with plist files(except editing them). Any tutorials ? 回答1: This is from one of my apps: This is in

Moving annotation from one coordinate point to another in Swift

◇◆丶佛笑我妖孽 提交于 2019-12-13 06:59:17
问题 This is a repost. I tried all I could do to get this thing done but wasn't successful. I have two coordinate points and all I'm trying to do is moving an annotation from one point to another. As an alternative solution, I found an Obj-C project in github which is very similar to this and I made a bridged connection between Swift and Obj-C to get this done. But for just moving annotation I had to use this whole project which I found is not a good solution. Anyone who was successful in

How do I load different custom pins or identifiers based off of their property values?

荒凉一梦 提交于 2019-12-13 05:17:51
问题 I have an array of objects that conform to <MKAnnotation> . I load this array into my annotations using addAnnotations:. In the method: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation: (id<MKAnnotation>)annotation I have every pin load a custom image using: annotationView.image = [UIImage imageNamed:@"purp_pin.png"]; However, I don't want all the pins to load with this image. I want it to load a different custom image/identifier depending on the properties the object that

iOS Pin color issue in mapkit

旧街凉风 提交于 2019-12-13 04:29:58
问题 I want my annotations in two colors. For that I have used following code, - (MKAnnotationView *)mapView:(MKMapView *)sender viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *identifier = @"MyLocation"; if ([annotation isKindOfClass:[PlaceMark class]]) { MKPinAnnotationView *annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; annotationView.enabled = YES; annotationView.canShowCallout = YES; @try { if (annotationView == nil)

Multiple Annotations (IOS) Easiest way

蓝咒 提交于 2019-12-13 02:16:28
问题 Im using Annotations in IOS to display London Tube stations, but im looking at numbers and there are 280 or so. Whats the easiest way to do this? Individually or is there another option? Cheers for all the advice David 回答1: The performance is good with 280 annotations, the appearance is not. You have to group them into clusters when the user zooms out. One way to do it is: Decide how many cluster annotations you want to show. Split the screen in x*y tiles so roughly x*y =~ numClusters and x/y