mkannotation

MKMapview place pin at location (long/lat)

本秂侑毒 提交于 2019-12-02 19:22:29
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? 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:addAnnotation]; [addAnnotation release]; You should: 1. add the MapKit framework to your project. 2. create a class

Custom annotation move animation IOS Swift Like Ola Uber App MapKit Swift [duplicate]

六眼飞鱼酱① 提交于 2019-12-02 18:39:42
问题 This question already has answers here : move animation with custom annotation IOS Swift Like Ola Uber App MapKit (1 answer) Move the annotation on Map like Uber iOS application (1 answer) Closed last year . This is repost. I want to move custom annotation with animation like Ola uber car with rotation. Please only provide solution in SWIFT Here is que link move animation with custom annotation IOS Swift Like Ola Uber App MapKit I only know swift 来源: https://stackoverflow.com/questions

How to add a custom CalloutView loaded from nib file

三世轮回 提交于 2019-12-02 18:07:49
问题 I'm trying to make a custom Callout view for AnnotationView. I had seen this answer, and seems a good solution (it works). I'm trying to load a UIView from a nib file, and the UIView appears, but his buttons don't work, don't get pushed. Is there a way of doing this?? How can I load the UIView from a nib file and get the buttons working?? Or maybe anyone help me finding a good solution. Thanks Here's the code I'm using: - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super

Adding different images to different annotation views in xcode

╄→гoц情女王★ 提交于 2019-12-02 12:18:04
问题 I am trying to add different images to different annotation views, in other words, i want a unique pic to correspond to each unique pin. Here is what I am trying: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { NSLog(@"welcome into the map view annotation"); // if it's the user location, just return nil. if ([annotation isKindOfClass:[MKUserLocation class]]) return nil; // try to dequeue an existing pin view first static NSString*

Show dynamic annotation pin in mapview

强颜欢笑 提交于 2019-12-02 10:57:45
问题 I am developing an app which use MKMapView . I have display multiple annotation in it. Now I want to display custom annotation image for pin. I have made custom class for MapViewAnnotation. #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface MapViewAnnotation : NSObject <MKAnnotation> @property (nonatomic,copy) NSString *title; @property (nonatomic,copy) NSString *subtitle; @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; -(id) initWithTitle:(NSString *)

Custom annotation move animation IOS Swift Like Ola Uber App MapKit Swift [duplicate]

守給你的承諾、 提交于 2019-12-02 10:21:21
This question already has an answer here: move animation with custom annotation IOS Swift Like Ola Uber App MapKit 1 answer Move the annotation on Map like Uber iOS application 1 answer This is repost. I want to move custom annotation with animation like Ola uber car with rotation. Please only provide solution in SWIFT Here is que link move animation with custom annotation IOS Swift Like Ola Uber App MapKit I only know swift 来源: https://stackoverflow.com/questions/48394319/custom-annotation-move-animation-ios-swift-like-ola-uber-app-mapkit-swift

How to add a custom CalloutView loaded from nib file

心已入冬 提交于 2019-12-02 09:36:18
I'm trying to make a custom Callout view for AnnotationView. I had seen this answer , and seems a good solution (it works). I'm trying to load a UIView from a nib file, and the UIView appears, but his buttons don't work, don't get pushed. Is there a way of doing this?? How can I load the UIView from a nib file and get the buttons working?? Or maybe anyone help me finding a good solution. Thanks Here's the code I'm using: - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; if(selected) { //Add custom view to self... calloutView = [[

On mkuserlocation, how do I show my own custom message in viewForAnnotation

旧城冷巷雨未停 提交于 2019-12-02 09:34:52
I want to show a custom message instead of "My Location" in viewForAnnotation. How do I do this? Thanks Deshawn Anurag In the delegate of your MKMapView , implement the method mapView:viewForAnnotation and check if the annotation is of type MKUserLocation . If yes, change the title and subtitle properties of the annotation. The callout will automatically pull the new values. Or you can create a totally new view and return it here. - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isKindOfClass:[MKUserLocation class]]) {

Set annotation's title as current address

[亡魂溺海] 提交于 2019-12-01 22:46:13
I want to get the current location's address and set it to the annotation's title. But it didn't work. I think it's because of the block, but I don't know how to fix it. Any help will be appreciated. The most related code is as following: WhereAmIAnnotation.h #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface WhereAmIAnnotation : NSObject <MKAnnotation> { CLLocation *myLocation; NSString *addr; } @property (nonatomic, retain) CLLocation *myLocation; @property (nonatomic, copy) NSString *addr; @end WhereAmIAnnotation.m #import "WhereAmIAnnotation.h" @implementation

Convert MKAnnotation Coordinates to View Coordinates

梦想的初衷 提交于 2019-12-01 22:01:46
I am displaying a custom UIView when the user clicks on the pin (Like the Zillow app). Now the problem is that I need to place the view right above the actual pin. The MKAnnotationView coordinates system is related to the map. How can I get the coordinates with respect to the iPhone screen and then place my view on that coordinate. - (void)mapView:(MKMapView *)mv didSelectAnnotationView:(MKAnnotationView *)view { // get view from storyboard ZillowSearchResultAnnotation *annotation = (ZillowSearchResultAnnotation *) view.annotation; PropertyAbstractViewController *propertyAbstractViewController