mkannotationview

Custom MKAnnotationView - How to capture touches and NOT dismiss the callout?

孤人 提交于 2019-12-22 09:49:26
问题 I have a custom MKAnnotationView subclass. It is showing the view exactly as I want it to. In that view, I have a button. I want to capture events on the button to perform an action. This works just fine. However, I do NOT want the callout to be dismissed or disappear. Basically, touching the button in the callout will start playing a sound, but I want to leave the annotation up so the user can press stop if they want to, without having to touch the map pin again to bring the annotation back

how to add custom callout view in mapview

女生的网名这么多〃 提交于 2019-12-22 04:09:49
问题 I am new to mapkit in objective-c. I am able to add custom annotation in mapview. i need to place custom callout view like below image . But i didn't get how can i design callout view like this. i know i need to add callout in view for annotation method. - (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *AnnotationViewID = @"annotationViewID"; MKAnnotationView *annotationView = (MKAnnotationView *)[mapview

Swift - setting different images from array to annotation pins

爷,独闯天下 提交于 2019-12-19 11:25:17
问题 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

Custom Annotation View do not work on iOS6

被刻印的时光 ゝ 提交于 2019-12-19 10:18:53
问题 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! 回答1: If annotations are displayed over

IOS: Adding image to custom MKAnnotationview

风格不统一 提交于 2019-12-18 16:54:27
问题 I want to add a custom image to my annotations in the map. And i have made the following custom MapAnnotationView: #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> #import <CoreLocation/CoreLocation.h> @class POI; @interface MapAnnotation : MKAnnotationView <MKAnnotation > @property (nonatomic) CGFloat lat; @property (nonatomic) CGFloat lon; @property (nonatomic) CGFloat altitude; @property (nonatomic, copy) NSString * title; @property (nonatomic, copy)

iOS Swift MapKit making an annotation draggable by the user?

↘锁芯ラ 提交于 2019-12-18 12:55:29
问题 How do I make it possible, using MapKit in Swift, for the user to drag an annotation from one position to another within the map? I have set the annotation view to be draggable, when my map view delegate creates the annotation view, like this: func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { var v : MKAnnotationView! = nil if annotation is MyAnnotation { let ident = "bike" v = mapView.dequeueReusableAnnotationView(withIdentifier:ident) if v == nil {

How to stop the viewForAnnotation method from overriding the default user location blue beacon in iOS

时光毁灭记忆、已成空白 提交于 2019-12-18 12:15:23
问题 Right now I am populating a map view with annotations, and also displaying the user's current location. With the viewForAnnotation method, it overrides all annotations with the default red pin, but I want to return the views for the other annotations, but keep the user location the default blue beacon. Is there a way to do this simply or do I have to create a new annotation view and return the right one depending on the annotation? Right now I have something like: - (MKAnnotationView *

Car (Annotation) animation (like uber app) not working

最后都变了- 提交于 2019-12-18 10:03:16
问题 I made one demo project (from Moving-MKAnnotationView demo on github) for moving car on map following is its link https://github.com/pratikbhiyani/Moving-MKAnnotationView I edit my code on the basis of given answer by vinaut but still problem is that when we zoom or scroll the map animation get distract in ios 7 and in ios 6 when we zoom or scroll the map annotation set to its original angle for a while. Below is a screen shot of my Demo Project Here is some code i change - (void) setPosition

MKMapView Clicking on pins won't call didSelectAnnotationView

点点圈 提交于 2019-12-18 08:31:22
问题 I am using a mapView and am trying to make a callout pop up when you click on a pin which is shown on the map. The pins manage to be placed in the proper locations so I think the annotations work but when I click on the pin it won't show a callout. I have show callout = YES. The method didSelectAnnotationView does not get called at all when I click on the pin. Are there some common problems which may cause this method not to be called? 回答1: If tapping on a pin doesn't show the callout even if

Custom pin image in annotationView in iOS

冷暖自知 提交于 2019-12-17 17:34:35
问题 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