mkannotation

Issue with overlapping annotations (MKAnnotationView) on map

本秂侑毒 提交于 2019-12-03 12:18:59
In my iphone application, I'm using MapKit with MKMapView and custom MKAnnotationView. The problem is when annotations overlap on map (in my app, annotations are photos and those photos may overlap) and when you tap on the annotation that appears on front, it's another annotation (on back) which receives the event (seems to be random). I didn't find any way to send the event to the front annotation. I cannot believe this bug/problem doesn't have any solution! Z ordering and Order of overlapping annotations questions on stackoverflow did not help me that much. Please any idea is welcome (even

How to Hide MKAnnotationView Callout?

风格不统一 提交于 2019-12-03 10:45:20
i'm trying to hide an AnnotationView without touching the pin, is the possible? Thanks! for (id currentAnnotation in self.mapView.annotations) { if ([currentAnnotation isKindOfClass:[MyAnnotation class]]) { } } Do you just want to make the callout bubble go away but keep the pin? If yes, then do this: for (id currentAnnotation in self.mapView.annotations) { if ([currentAnnotation isKindOfClass:[MyAnnotation class]]) { [self.mapView deselectAnnotation:currentAnnotation animated:YES]; } } 来源: https://stackoverflow.com/questions/2918154/how-to-hide-mkannotationview-callout

MKMapView with custom MKAnnotation

*爱你&永不变心* 提交于 2019-12-03 09:43:11
I've a MKMapView. I want to put a custom MKAnnotation on my map. They are some restaurant places. How can I do it? My question is how can I make a custom MKAnnotation? Thanks, guys. If you totally want to customize the callout View of the annotation.. See this link.. http://blog.asolutions.com/2010/09/building-custom-map-annotation-callouts-part-1/ Cameron Lowell Palmer First, let's define custom as meaning not simply title and subtitle. We want to change the size of the MKAnnotation and include some custom graphics. There are two parts to an annotation you might want to customize:

Different font for MKAnnotationView

这一生的挚爱 提交于 2019-12-03 09:01:24
On the callout bubble on the iPhone SDK's map, can the font be changed for the title and subtitle properties. I am displeased with the default font shown in the callout bubble, and would like to go with a different font face to match the rest of my application. However, I have not seen much mention of this, which has me concerned that it might not be possible. I have seen the Building Custom Map Annotation Callouts tutorial, and I guess that would work. But, if at all possible I was hoping that the ability to change a font was built into the MKAnnotationView much the same way I can change the

Display MKMapViewAnnotations within a map view's visible rect

佐手、 提交于 2019-12-03 06:16:38
问题 I'm displaying an MKMapView inside a Path-style parallax table view header. To create the effect, the mapView bounds is larger than the area visible to the user. I need to set the map view region such that all the map's annotations are contained within the visible rect of MKMapView. What's the best way to do this? Edit for clarity: Here's a use-case. The mapView size is 320 x 380. The visible area, however, is defined by the rect (0.0, 20.0, 320.0, 100.0). I need to set the region such that

MKMapview place pin at location (long/lat)

萝らか妹 提交于 2019-12-03 05:02:55
问题 I have latitude and long values and I need to be able to drop a pin at this location. Can anybody provide some advice on how to go about this? 回答1: Find the below very simple solution to drop the pin at given location define by CLLocationCoordinate2D Drop Pin on MKMapView Edited: CLLocationCoordinate2D ctrpoint; ctrpoint.latitude = 53.58448; ctrpoint.longitude =-8.93772; AddressAnnotation *addAnnotation = [[AddressAnnotation alloc] initWithCoordinate:ctrpoint]; [mapview addAnnotation

Animate MapKit annotation coordinate change in Swift?

南楼画角 提交于 2019-12-03 04:17:05
问题 When using MapKit in iOS 8 in Swift, how do I make it possible to animate a change in the map position of a custom annotation? I am saying this: UIView.animateWithDuration(0.25) { var loc = ann.coordinate loc.latitude = loc.latitude + 0.0005 loc.longitude = loc.longitude + 0.001 ann.coordinate = loc } ...where ann is a custom annotation, MyAnnotation. The annotation is jumping, not animating, to the new coordinate position. The annoying thing is that the animation works perfectly if I write

How to check if annotation is clustered (MKMarkerAnnotationView and Cluster)

て烟熏妆下的殇ゞ 提交于 2019-12-03 03:56:05
I'm trying to work with the new features added to the mapview in ios11. I'm clustering all my MKAnnotationView with circle collision but I have to check in real time when the annotation becomes clustered. I have no idea how to do that. EDIT (4/1/2018) : More informations : When I select an annotation I add a custom CallOutView when the didSelect method is called and remove the CallOut when the didDeselect method is called. The issue is when an annotation is selected and becomes clustered, when you zoom in the annotation is still selected but in "normal" state. I want to remove the CallOut of

Size image pin annotation

 ̄綄美尐妖づ 提交于 2019-12-03 02:39:18
I put the personal image instead of the traditional red pin. When I open the map to display the pin, the image cover the entire map. Is there a maximum size of the pin image or how do I integrate something in the code to fit the size standard classic pin? func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? { if annotation is MKUserLocation { return nil } let annotationIdentifier = "SomeCustomIdentifier" // use something unique that functionally identifies the type of pin var annotationView: MKAnnotationView! = mapView

Display MKMapViewAnnotations within a map view's visible rect

隐身守侯 提交于 2019-12-02 19:40:13
I'm displaying an MKMapView inside a Path-style parallax table view header. To create the effect, the mapView bounds is larger than the area visible to the user. I need to set the map view region such that all the map's annotations are contained within the visible rect of MKMapView. What's the best way to do this? Edit for clarity: Here's a use-case. The mapView size is 320 x 380. The visible area, however, is defined by the rect (0.0, 20.0, 320.0, 100.0). I need to set the region such that all the annotations appear in this rect within the mapView. Setting the map region so that all