mkannotationview

Force MKMapView viewForAnnotation to update

断了今生、忘了曾经 提交于 2021-02-06 15:18:33
问题 So I have a MKMapView with all my pins added, and the colour of the pin is dependent on whether a value is set for that pin. When I first load the app, viewForAnnotation is called and the colours are set accordingly. However, when I update the pin's details (such as location, title, etc...) I also update the pinColour to find it doesn't update. It looks like viewForAnnotation isn't called again after the initial add. I have read many questions similar to this and I can confirm that mapView

Force MKMapView viewForAnnotation to update

安稳与你 提交于 2021-02-06 15:17:59
问题 So I have a MKMapView with all my pins added, and the colour of the pin is dependent on whether a value is set for that pin. When I first load the app, viewForAnnotation is called and the colours are set accordingly. However, when I update the pin's details (such as location, title, etc...) I also update the pinColour to find it doesn't update. It looks like viewForAnnotation isn't called again after the initial add. I have read many questions similar to this and I can confirm that mapView

Subclasses of MKAnnotationView

喜夏-厌秋 提交于 2020-03-18 06:06:26
问题 I was wondering if anyone knows of any subclasses for the MKAnnotationView class. On apples documentation they say one example is the MKPinAnnotationView so I was wondering if there were other pre-created subclasses like the one used to track the devices current location. If anyone has tips for creating my own subclass of the MKAnnotationView class that be great as well. Thanks, bubster 回答1: I don't know of any other templates, but that does not mean that they don't exist. :) Anyway, here's

How to dissmiss the add Annotation Animation of a MKAnnotation?

非 Y 不嫁゛ 提交于 2020-01-24 19:31:09
问题 I need to add a big number of annotations on a MKMapview and, the animation which give the impression that the pin falls on the map make that take lot of time to display all of them. Anyone can help me ? Sorry for my english ! Thanks 回答1: You can disable dropping animation with animatesDrop attribute - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{ MKAnnotationView *annView =[[[MKAnnotationView alloc] initWithAnnotation:annotation

How to create custom pin annotation view

萝らか妹 提交于 2020-01-17 14:51:48
问题 I have a map I'm populating with a list of food trucks, and I'd like to implement a custom callout like the one shown below, when an annotation is selected. Currently I have the standard annotation callout implemented with a title and subtitle. I've done some reading and am guessing it'll require a custom .xib file, but I don't really know anything about this as I only started developing for iOS as a recently. How would I go about creating this custom popup, and how can I make it perform a

Turning user location annotation with heading

我只是一个虾纸丫 提交于 2020-01-12 08:40:12
问题 I'm trying to change the User Annotation in my app so that it shows the usual blue dot, but with a triangle coming off of it to show which direction the user is facing (I'd rather rotate the user annotation than the entire map, which is what MKUserTrackingModeFollowWithHeading does). I've got a rudimentary version working, but it has some weird behavior. First, some code: -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { if ([annotation

MKAnnotationView with custom view and image view

本小妞迷上赌 提交于 2020-01-12 08:39:31
问题 In my Map application, instead of showing a pin, I want to show a colored background circle with image in it. The color of the background (which is shade of green in below image) circle is dynamic. It will look as in below image: I created TCircleView which draws the color in "drawRect" To show similar annotation, I created object of TCircleView and UIImageView and add them to MKAnnotationView object. Its looking good and visible as expected. But its not allowing to detect tap/touch to show

Putting UIButton and other UIControl objects inside an MKAnnotationView and allowing user interaction

牧云@^-^@ 提交于 2020-01-12 07:37:05
问题 I have a custom annotation view on the map, which has a UIButton in it, but the UIButton is not responsive when pressed. I have two main problems with user interaction on the annotation view: Buttons and other controls are not responsive. I want the annotation to block touches according to my implementation of - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent*)event - that is if I return YES then I don't want the touches to get sent through to the MKMapView (potentially selecting other

Change map pin (color or image)

孤街醉人 提交于 2020-01-06 08:27:30
问题 I know this is a question asked a lot. I have been reading through many of the questions on here regarding this for a while. I was hoping someone would have a simpler way using the code I have to replace the pins on my map with an image. I am still very new to objective c.The code I have is very short and easy. Most of what I have found online to post pins to a map is very long and drawn out. I have the following classes and controllers for my map view: LocationsViewController.h #import