mkannotationview

How to add an image for each customized annotation on MapView?

。_饼干妹妹 提交于 2019-12-11 11:08:06
问题 I have a class of Picture which contains latitude and longitude and image of each location. I want to add them as annotation to the MapView and show its image instead of pin for those locations. I have a customized annotation which is: @interface Annotation : MKAnnotationView <MKAnnotation> @property (nonatomic,assign) CLLocationCoordinate2D coordinate; @property (nonatomic,copy) NSString *title; @property (nonatomic,copy) NSString *subtitle; @property (nonatomic,retain) UIImage *image; @end

map annotation with different marker using swift 3

柔情痞子 提交于 2019-12-11 08:48:20
问题 I am working in map view annotation. The marker annotation should be displayed using the parking rule type If paid pin image be "paid" and if free pin image be "free" I am getting all annotation as "paid" image I have attached my code below can any one help me in this issue to fix func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { // Don't want to show a custom image if the annotation is the user's location. guard !(annotation is MKUserLocation) else {

MKMapView iOS custom user location Annotation not showing/updating position

喜夏-厌秋 提交于 2019-12-11 07:20:07
问题 Hi I am using a custom annotation in replacement of the blue GPS position dot. I have added it to the map like so in the viewForAnnotation. OurLocAnnotation class conforms to MKAnnotation delegate. //Custom location view if([annotation isKindOfClass:[OurLocAnnotation class]]) { static NSString *identifier = @"currentLocation"; SVPulsingAnnotationView *pulsingView = (SVPulsingAnnotationView *)[self.recycleMap dequeueReusableAnnotationViewWithIdentifier:identifier]; if(pulsingView == nil) {

UIButton Not Loading Properly For MKAnnotationView

瘦欲@ 提交于 2019-12-11 06:47:54
问题 I am creating an MKAnnotationView with a detail disclosure button. In mapView: viewForAnnotation: I just create an placeholder button. // the right accessory view needs to be a disclosure button ready to bring up the photo aView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; In mapView: didSelectAnnotationView: I actually create a button to be used (with the relevant tag) // create a button for the callout UIButton *disclosure = [self.delegate

MKPinAnnotationView loses pinColor after MKMapView zoom in

别等时光非礼了梦想. 提交于 2019-12-11 05:59:21
问题 I have a MKMapView with a lot of annotation pins defined from a parser xml; thats my code: -(IBAction)LoadAnnotation:(id)sender { RXML element ... RXML iterate.... [myMap removeAnnotations:myMap.annotations]; annotation.title = // NSString from RXML parser annotation.subtitle = // NSString from RXML parser myValue = // float value from RXML parser [mymap addAnnotation:annotation]; } and then - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation2

Add extra detail to MKPointAnnotation other than title and subtitle

混江龙づ霸主 提交于 2019-12-11 04:31:26
问题 I wish to pass informations from a Pin annotation to another viewController.I can pass the title and subtitle of the annotation but I need to pass some extra information along with these. Is there a way to add extra information to a MKPointAnnotation other than just title and subtitle? here I have the pin title and subtitle set so it appears on the map: var zoopin = MKPointAnnotation() zoopin.coordinate = zoo zoopin.title = "The zoo" zoopin.subtitle = "hello this is the zoo" mapView

Different custom image for each pin

帅比萌擦擦* 提交于 2019-12-11 03:58:00
问题 This may sound like a generic question but I've only found answers if I want the same image for all my pins, which i don't. That's how i'm working right now : I have all my locations in an array of Locations (custom class with long, lat, name, pin name). in the viewdidLoad I loop that array and create my pins with every object found, see following code : for(int i = 0 ; i<[_locationList count] ; i++) { Location *item = [_locationList objectAtIndex:i]; CLLocationCoordinate2D coordinate;

Setting Map Pin colour dynamically for iOS

泄露秘密 提交于 2019-12-11 01:59:41
问题 I parse an xml that contains the string 0 ,1 and 2. //For reference 0 = Green 1 = Red 2 = Purple I have a class that confirms to the MKAnnotaion that contains the below variables that are properties. CLLocationCoordinate2D coordinate; NSString *title; NSString *subtitle; MKPinAnnotationColor pinColor; This class is named MyAnnotation Now in the viewDidLoad of the map view I run a for loop to iterate over the parsed data like the below (locationArray holds this data and I pull out all the info

How can the MKUserLocation be programmatically selected?

纵饮孤独 提交于 2019-12-10 19:37:46
问题 Titles and subtitles can be added to the user location that iOS shows using MKUserLocation. When the user taps on the location, these will show in a bubble above the location. The thought bubbles for other annotations can be shown by selecting the annotation with setSelected:animated: from MKAnnotationView. Unfortunately, MKUserLocation does not descend from MKAnnotationView. How can I programmatically select the user location so the annotation appears over the user location without the user

Custom map callout view hides on tap

早过忘川 提交于 2019-12-10 15:46:47
问题 I've made custom map callouts. My callouts contains UIButtons and UITextView . When I tap UIButton , it presses nice. But when I tap UITextView it moves cursor to tap position and then deselects pin and disappears callout... I've implemented hitTest:withEvent: method of MyAnnotationView like here: https://stackoverflow.com/a/13495795/440168 But as I see in log, [super hitTest:withEvent:] never returns nil . Here is my MyAnnotationView methods: - (BOOL)pointInside:(CGPoint)point withEvent: