mkannotation

Moving annotations in MKMapView according to server data (latitude and longitude)

这一生的挚爱 提交于 2019-12-01 19:08:48
In my app I am showing location of some other person by getting their location (latitude and longitude) from server at particular interval. After getting I have to remove all annotations and drop new annotations based on the server data. But it looks very inefficient as when we have the annotation for the same user previously exists even then I'm removing and adding the same user annotation. So I want to know can we move the MKAnnotation from one coordinate to other? I have tried "setCoordinate" property but unable to succesfuly implement it. Also it is not "touch and drag" kind. The

Swift - setting different images from array to annotation pins

独自空忆成欢 提交于 2019-12-01 13:15:00
I wonder how to set different images to annotation pins on mapview. The difference between the following questions viewForAnnotation confusion and customizing the pinColor iteratively Swift different images for Annotation is that my array of images is generated dynamically with regard to server response. There is no fixed size of the array, so switch/case construction is not a good idea. Moreover, I'm not sure how to apply the solution with custom class aforementioned in topic above. I'm aware that it would be better to post a comment to one of the questions asked before, but unfortunately I'm

Custom Annotation View do not work on iOS6

梦想与她 提交于 2019-12-01 11:47:09
I'm using the J4n0 Callout code ( github ) to implement a custom annotation in MapKit. It was working just fine on iOS5. But on iOS6 I have 2 problems: Annotations are displayed over the AnnotationView (see picture 1). The first Click on an Annotation opens the AnnotationView just fine, but the second click opens an annotation with a bad size (see picture 2). Does anyone using this library have some similar problem/solution? I can give some code if needed! Sibear If annotations are displayed over the AnnotationView try to code: - (void)didMoveToSuperview { [super didMoveToSuperview]; [self

Longer subtitles in MapView annotations (swift)

吃可爱长大的小学妹 提交于 2019-12-01 11:36:12
I have a mapView with annotations displaying titles and subtitles. The subtitles are sometimes longer than the width of the annotation, so I am wondering if i can make them multiline? It's coded like this so far: func annotate(newCoordinate, title: String, subtitle: String) { let annotation = MKPointAnnotation() annotation.coordinate = newCoordinate annotation.title = title annotation.subtitle = subtitle self.map.addAnnotation(annotation) } Then i have a few options set in func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {...} which are not

iOS MapKit show nearest annotations within certain distance

自古美人都是妖i 提交于 2019-12-01 10:30:13
问题 Currently i am working on a Location based application for iPhone/iPad . I have several annotations in my MapKit , what i want to do is to track the location of the user and shows the annotations that are within the 3km . Can somebody give me a start ? 回答1: Sorry for the delayed response... the question just fell off my radar. I'm going to suppose that you have a method that returns a set of NSValue-wrapped CLLocationCoordinate2D structs (the basic approach is the same regardless of what your

Is it possible to force MapKit to show all annotations without clustering?

孤者浪人 提交于 2019-12-01 05:47:37
问题 I have two classes that both conform to MKAnnotation , and I was wondering, is there a way to force MapKit to not cluster the annotation when a user zooms out and display all annotations? 回答1: Set MKAnnotation's clusteringIdentifier to nil. e.g. class BikeView: MKMarkerAnnotationView { override init(annotation: MKAnnotation?, reuseIdentifier: String?) { super.init(annotation: annotation, reuseIdentifier: reuseIdentifier) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has

Map annotation display all the same image/pins for all points

不打扰是莪最后的温柔 提交于 2019-12-01 01:32:32
I have a conditional statement to add map annotation icons/pins in the method below. The problem I'm having is that the map is being populated with all the same icon. It should detect the cat id and display the icons depending on which cat id is detected. I'm not sure what the problem is because this did work in iOS 6 and now in iOS 7 the map only displays all the same annotation icon images. - (MKAnnotationView *) mapView:(MKMapView *)mapingView viewForAnnotation:(id <MKAnnotation>) annotation { annView = nil; if(annotation != mapingView.userLocation) { static NSString *defaultPinID = @"";

Map annotation display all the same image/pins for all points

女生的网名这么多〃 提交于 2019-11-30 20:48:01
问题 I have a conditional statement to add map annotation icons/pins in the method below. The problem I'm having is that the map is being populated with all the same icon. It should detect the cat id and display the icons depending on which cat id is detected. I'm not sure what the problem is because this did work in iOS 6 and now in iOS 7 the map only displays all the same annotation icon images. - (MKAnnotationView *) mapView:(MKMapView *)mapingView viewForAnnotation:(id <MKAnnotation>)

Zoom to fit region for all annotations - ending up zooming in between annotations

拥有回忆 提交于 2019-11-30 15:30:32
I have a problem with fitting all my annotations to the screen... sometimes it shows all annotations, but some other times the app is zooming in between the two annotations so that none of them are visible... I want the app to always fit the region to the annotations and not to zoom in between them... what do I do wrong? if ([mapView.annotations count] == 2) { CLLocationCoordinate2D SouthWest = location; CLLocationCoordinate2D NorthEast = savedPosition; NorthEast.latitude = MAX(NorthEast.latitude, savedPosition.latitude); NorthEast.longitude = MAX(NorthEast.longitude, savedPosition.longitude);

Hide MKUserLocation when MKMapView showsUserLocation == YES

微笑、不失礼 提交于 2019-11-30 15:26:41
问题 After setting mapView.showsUserLocation to true, is it possible to receive location updates without showing the MKUserLocation bubble? Returning nil in mapView:viewForAnnotation: simply shows the bubble, and returning any other kind of annotation shows an annotation, which I don't want. 回答1: You can hide the user location's view in the didAddAnnotationViews delegate method: -(void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views { MKAnnotationView *ulv = [mapView