mkannotation

Longer subtitles in MapView annotations (swift)

廉价感情. 提交于 2020-01-11 06:58:10
问题 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

Store data in MKAnnotation?

落爺英雄遲暮 提交于 2020-01-08 16:36:36
问题 So I'm pretty new to Xcode and Objective-C. I have several ArtPiece objects with various attributes stored in an array. I then add them as MKAnnotations to the mapview. What I need to be able to do is send a reference to the array position they came from on click. I believe MKAnnotations only have the data members title, image, and location, so when I make an MKAnnotation from the objects, the annotation does not keep any of the other attributes. So, my question is, how can I manage to keep a

Store data in MKAnnotation?

走远了吗. 提交于 2020-01-08 16:34:22
问题 So I'm pretty new to Xcode and Objective-C. I have several ArtPiece objects with various attributes stored in an array. I then add them as MKAnnotations to the mapview. What I need to be able to do is send a reference to the array position they came from on click. I believe MKAnnotations only have the data members title, image, and location, so when I make an MKAnnotation from the objects, the annotation does not keep any of the other attributes. So, my question is, how can I manage to keep a

Swift cannot assign subtitle in MKAnnotation

三世轮回 提交于 2020-01-06 03:41:04
问题 I'm attempting to programmatically update the subtitle within MKAnnotation . The following lines of code produce a cannot assign subtitle in annotation error: let annotation: MKAnnotation = mapView.annotations[0] as! MKAnnotation annotation.subtitle = nil Could anyone help lead me in a direction where I can update the subtitle after the MKAnnotation is shown within the map? 回答1: MKAnnotation is a protocol . In that protocol, subtitle is read-only. That means it cannot be set. So, because you

Callout opening wrong view after zoom in iOS7

ε祈祈猫儿з 提交于 2020-01-05 10:38:07
问题 Everything is working fine in my app except for one thing: after zooming in and zooming back out, to see the whole map, some callouts open the wrong detailview. I don't know if I'm missing some code or else. Using Xcode 5.1.1 for iOS7. This is what I've got at the moment: Annotation.h #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface Annotation: NSObject <MKAnnotation> @property (nonatomic, assign) CLLocationCoordinate2D coordinate; @property (nonatomic, copy) NSString

How to delete the last annotation on a mapView

萝らか妹 提交于 2020-01-03 03:41:09
问题 I have added a button on my .xib file with which I want to delete the last annotation that has been added. So on the Touch-Down action I have implemented this: -(IBAction)DeleteAnnotation:(id)sender { [mapview removeAnnotation:[mapview.annotations lastObject]]; } and I have even tried it this way: -(IBAction)DeleteAnnotation:(id)sender { [self.mapview removeAnnotation:self.mapview.annotations.lastObject]]; } where mapview is my MKMapView Outlet. The problem I encounter with both ways is that

How to show Cluster for MKPolyline with geojson data View in iOS Swift

你说的曾经没有我的故事 提交于 2020-01-03 02:31:10
问题 I am loading Mapview with geojson data. It contains 7000 data in that geojson file. Even I loaded that data into Mapview . Its loaded fine, but, the problem is mapview getting freezing/stucking for few seconds while zoomin/zoomou So, its getting very bad user experience. Even, I loaded the data in background thread, still mapview getting freeze. After I read few forums, we can load clusters to avoid this kind freeze UI issue for mapview, but, I did not found for geojson data loading with

MapView with clusters: how to display multiple annotations on same view

北城余情 提交于 2020-01-02 09:55:32
问题 I have integrated FBAnnotationClustering on mkmapview which works perfectly, but when there is more than one annotation at exactly the same place I cannot display the annotationView with the correct informations. I'm trying to loop through the annotations and display them in the same view (each with a callout button to display more info). So far I managed to make one callout work to display the details at the bottom, but in the annotationView it displays it without the right title, and there

iOS 6 maps- not animating PIN drop

血红的双手。 提交于 2020-01-02 09:11:10
问题 I have created a custom MKAnnotation class and it has been working - until iOS 6 came out. Since then my pins get added to the apple map but now without a drop animation! Is this how it is set or there maybe an an issue with the way I'm doing things. I have set a delay of 1 sec until the method that adds the annotations to the map is called, so I can see if the drop animations are actually occurring before the view appears - still, the pins just appear out of nowhere without dropping. Here's

Protocol can only be used as a generic constraint

我的梦境 提交于 2020-01-02 05:42:07
问题 I have a MapViewController for presenting annotations on map. It contains an object of type MapPresentable. protocol MapPresentable { associatedtype AnnotationElement: MKAnnotation var annotations: [AnnotationElement] { get } } class MapViewController<M: MapPresentable>: UIViewController { var mapPresentable: M! } MapViewController can also present route on map in case mapPresentable conforms to RoutePresentable protocol. protocol RoutePresentable: MapPresentable { var getRouteLocations: