mkannotation

Warning in Custom Map Annotations iPhone

*爱你&永不变心* 提交于 2019-11-27 23:11:30
I am using a custom map annotation class for map view in iPhone. Whenever I pop my map view from navigation bar stack I usually see some warnings in console. MapAnnotation was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info: I am not using KVO in my code hence not able to understand why I am receiving these warnings Latitude and Longitude have differing bounds: (-90, 90) for Lat

Move the annotation on Map like Uber iOS application

自闭症网瘾萝莉.ら 提交于 2019-11-27 17:11:10
I am working on a project where I need to create the similar iOS application to UBER and OLA where the car is moving based on the location. I'm looking for some kind of Library which can make Cars move and take turn smoothly just like OLA. For now I was able to move car from one latitude-longitude to another. But the complex part is how to turn and make sure the car face to front when moving to direction. Please find the below screenshot for the same. Actually I had also one requirement in my previous iOS application, so please find the below url for download the code and review it. Link for

Is it possible to call animatesDrop in a MKAnnotationView rather than MKPinAnnotationView?

≡放荡痞女 提交于 2019-11-27 16:24:20
问题 do you know that MKPinAnnotationView has a method "animatesDrop" to animate a pin annotation from the top to point on the map with a shadow? OK, is it possible do this with a custom image?? 回答1: You can always do your custom animation in MKMapViewDelegate method. - (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views Probably something like that (you won't get the fancy shadow animation, if you want it you need to do it yourself) : - (void) mapView:(MKMapView *)mapView

Tracking MKMapView centerCoordinate while panning

纵然是瞬间 提交于 2019-11-27 14:31:57
I'm implementing a map feature in my app where I allow the user to set their current location by panning around. All this time, I want to have an MKAnnotation in the centerCoordinate . So what I want to do is keep track of when the map's centerCoordinate changes and change the annotation's coordinate correctly. The behaviour would be similar to that of Uber , Hailo and others. I tried a time based implementation where every 0.00001s the centerCoordinate would be checked and the annotation would also be moved. But if the map isn't flicked gently, the annotation jumps from one place to another

iPhone: Create MKAnnotation

三世轮回 提交于 2019-11-27 12:52:12
Can I create an MKAnnotation , or is it read only? I have coordinates, but I am not finding it easy to manually create an MKAnnotation with using setCoordinate . Ideas? MKAnnotation is a protocol. So you need to write your own annotation object that implements this protocol. So your MyAnnotation header looks like: @interface MyAnnotation : NSObject<MKAnnotation> { CLLocationCoordinate2D coordinate; } @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; // add an init method so you can set the coordinate property on startup - (id) initWithCoordinate:(CLLocationCoordinate2D)coord;

MKAnnotation, simple example

为君一笑 提交于 2019-11-27 12:50:27
Is there a simple example project for MKAnnotation ? I don't know what to pass at " addAnnotation ", as it wants some " id<Annotation> ". The examples at the developer site are all with arrays or parsers or so, I just need a very easy example to first understand, how the whole thing works. Thanks in advance.. EDIT: I set up a class Pin . In the .h it writes #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface Pin : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate; NSString *title; NSString *subTitle; } @property (nonatomic, readonly) CLLocationCoordinate2D

MapKit (MKMapView): zPosition does not work anymore on iOS11

可紊 提交于 2019-11-27 11:41:19
问题 On iOS11 the zPosition stopped working for the annotationView.layer. Every time the map region changes. No luck with original solution: layer.zPosition = X; No luck with bringViewToFront / SendViewToBack methods Xcode 8.3/9 UPDATE (SOLUTION thanks Elias Aalto): When creating MKAnnotationView: annotationView.layer.zPosition = 50; if (IS_OS_11_OR_LATER) { annotationView.layer.name = @"50"; [annotationView.layer addObserver:MeLikeSingleton forKeyPath:@"zPosition" options:0 context:NULL]; } In

Drag an annotation pin on a mapview

谁说胖子不能爱 提交于 2019-11-27 10:37:53
问题 The annotation pin is draggable but I couldn't drop it to the destination location. The problem is how could I get the destination location's coordinate where i drop the annotation pin? Any method exist? Edit 1: The center of the annotation pin seems never changed where ever I drop the pin. - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)annotationView didChangeDragState:(MKAnnotationViewDragState)newState fromOldState:(MKAnnotationViewDragState)oldState { if (newState

MKAnnotation not getting selected in iOS5

流过昼夜 提交于 2019-11-27 07:54:06
问题 My app places a pushpin on the map and then selects its using animation so the user has a visual clue and can immediately read the title/subtitle. The following code works in both iOS4 and iOS5, but in iOS5, the annotation doesn't get selected automatically unless I change the animation to NO in the selectAnnotation method. Any ideas why? MapAnnotations *pushpin = [[MapAnnotations alloc] initWithCoordinate:coordinate]; pushpin.title = [selectedStation valueForKey:@"name"]; pushpin.subtitle =

Animate removal of annotations

时光怂恿深爱的人放手 提交于 2019-11-27 05:45:26
问题 I have a map and a set of annotations, each with a 'parent' property. Currently when I add annotations I implement the didAddAnnotationViews method to animate those annotations so they appear to come from their parent's coordinate. Is there a way of doing this during the removal of annotations? When I remove an annotation from the map I want it to animate in to its parent coordinate, and as far as I know there is no equivalent for didAddAnnotationViews for when an annotation is removed. 回答1: