mkannotationview

Detect Tap on CalloutBubble in MKAnnotationView

三世轮回 提交于 2019-11-28 07:21:42
Im working with MKMapView and MKAnnotationView. I have an annotation in the map. When the users tap on it, the callOut Bubble is displayed. When the annotation is tapped again ( and the callOut Bubble is visible ) i need to change to another view. How can i detect the second tap, or the tap in the bubble? Could you add a gesture recognizer when you're initializing the MKAnnotationView ? Here's the code for inside dequeueReusableAnnotationViewWithIdentifier: UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(calloutTapped:)];

MKMapView moving Annotations Automatically - animate them?

半世苍凉 提交于 2019-11-28 07:01:34
I have a data set of annotations that can update very quickly. At the moment I remove all annotations before replotting them back onto the map. NSArray *existingpoints = [mapView.annotations filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"!(self isKindOfClass: %@)", [MKUserLocation class]]]; [mapView removeAnnotations:existingpoints]; I calculate where they are anyway within the custom object so would like to be able to call this and "move" the annotation without removing and re-adding it back to the map. The example call I make which works and I would like to almost "poll" is

How to access to an annotation attribute inside method calloutAccessoryControlTapped

你说的曾经没有我的故事 提交于 2019-11-28 06:39:41
问题 I am trying to open a detail viewController when a user taps on the callout from a map annotation. I have created a custom annotation subclass called myAnnotation, and there I have included a property called idEmpresa. At a custom method I am declaring the annotation as follows: double latitud = [[[categorias objectAtIndex:i] objectForKey:@"latitud"] doubleValue]; double longitud = [[[categorias objectAtIndex:i] objectForKey:@"longitud"]doubleValue]; CLLocationCoordinate2D lugar; lugar

Resize MKAnnotationView Image When map zooms in and out?

别来无恙 提交于 2019-11-28 06:38:13
What i have I have about 150 MKAnnotationViews on a map. Every MKAnnotationView has an image that replaces the default pin. What's happening now When the map zooms in, the MKAnnotationViews are getting smaller and the opposite when it zooms out. What I wish Happened Well i want it to be the other way around. Since when the map is small I wish that the MKAnnotationViews will be smaller so the user can see all of them, and when he zooms in I wish they will be bigger. What code I have so far I know how to get the zoom change, and i know i can get the "pMapView.region.span.latitudeDelta" as a

MKMapView MKPointAnnotation tap event not called

谁说胖子不能爱 提交于 2019-11-28 05:16:12
问题 I am using a MKMapView (delegate is set correctly) with a MKPointAnnotation. The annotations are generated in this method called on a background thread. func updateMapAnnotations() { for var i = 0; i < DataManager.getStationList().count; i++ { var s = DataManager.getStationList()[i] as Station var annotation = MKPointAnnotation() annotation.setCoordinate(CLLocationCoordinate2D(latitude: s.latitude, longitude: s.longitude)) annotation.title = "\(s.id)" dispatch_async(dispatch_get_main_queue(),

Customise iOS8 Callout bubble (Swift)

杀马特。学长 韩版系。学妹 提交于 2019-11-28 04:35:27
I want to customise the iOS8 MapView Callout bubble which get visualised when clicking on a MKAnnotationView. The Default bubble is a bit limiting (having only Title,Subtitle and 2 accessory view) so I'm struggling to find an alternative solution. Here two possible ways and the relative problems I'm facing: PROBLEM 1) CREATING A CUSTOM CALLOUT BUBBLE Digging the Apple documentation I have found this: When you use a custom view instead of a standard callout, you need to do extra work to make sure your callout shows and hides appropriately when users interact with it. The steps below outline the

Custom pin image in annotationView in iOS

假如想象 提交于 2019-11-28 04:11:41
I'm trying to change from Swift 1.2 to Swift 2.0 and I'm at the end of the changes. Currently I'm making changes in the MapViewController, and there isn't any error or warning, but the custom image for my pin (annotationView) it's not assigned to the pin and it's showing the default one (red dot). Here is my code, I hope you can help me with some tip because I think everything is fine but it's still not working: func parseJsonData(data: NSData) -> [Farmacia] { let farmacias = [Farmacia]() do { let jsonResult = try NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions

viewForAnnotation confusion and customizing the pinColor iteratively

不问归期 提交于 2019-11-28 01:05:28
问题 The goal is to customize the pin colors per some values stored in an structure array. Per some help here I implemented the the following viewForAnnotation delegate method and that works great calling this delegate method iteratively in a loop based on the size of my structure data array. So it works if I want to set all the pins to one color, purple for example (which is the commented line in the code below). The problem is when I put in a switch to set the color based on a value in my array

MapKit iOS 9 detailCalloutAccessoryView usage

天大地大妈咪最大 提交于 2019-11-27 19:49:11
After watching WWDC video 206 I assumed this would be a trivial task of adding the detail callout view to a mapView annotation view. So, I assume Im doing something wrong. With my pin view set up func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? { let view:MKAnnotationView! if let dequed = routeMapView.dequeueReusableAnnotationViewWithIdentifier("pin") { view = dequed } else { view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "pin") } let x = UIView(frame: CGRectMake(0, 0, 200, 200)) x.backgroundColor = UIColor.redColor() //

MKAnnotation image offset with custom pin image

守給你的承諾、 提交于 2019-11-27 18:18:02
I have a MKAnnotation with an custom pin image. However the pin(MKAnnotationView) centers the image in relation to the specified coordinate. I want to set the point of the coordinate at the bottom center of the image, not center. I've tried using annView.centerOffset = CGPointMake(-12, -28); . But the problem is that centerOffset isn't relevant to the maps zoom level. One can do this both in the JS API and in Android. Is there any possibility to do this in objective-c? ..fredrik Your UIAnnotationView is always drawn at the same scale, the map's zoom level doesn't matter. That's why