mkannotation

Size image pin annotation

冷暖自知 提交于 2020-02-18 05:01:26
问题 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

Size image pin annotation

假如想象 提交于 2020-02-18 04:56:35
问题 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

Adding UIButton to MKAnnotationView

倖福魔咒の 提交于 2020-01-24 19:43:05
问题 I've a custom class of MKAnnotationView in which I'm trying to add 8 button to the annotation in a circular fashion.I've added the buttons.Their postion in the view is perfectly fine but the action of the buttons doesn't get called.Why the action is not getting called and what is the solution. -(void)setSelected:(BOOL)selected animated:(BOOL)animated` { [super setSelected:selected animated:animated]; if(selected) { UIView *circularView = [[UIView alloc]initWithFrame:CGRectMake(-55, -55, 110,

How to dissmiss the add Annotation Animation of a MKAnnotation?

非 Y 不嫁゛ 提交于 2020-01-24 19:31:09
问题 I need to add a big number of annotations on a MKMapview and, the animation which give the impression that the pin falls on the map make that take lot of time to display all of them. Anyone can help me ? Sorry for my english ! Thanks 回答1: You can disable dropping animation with animatesDrop attribute - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{ MKAnnotationView *annView =[[[MKAnnotationView alloc] initWithAnnotation:annotation

Set annotation's title as current address

一曲冷凌霜 提交于 2020-01-21 18:08:42
问题 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,

MKPinAnnotationView downloaded image (@3x) not working for 6+

不羁岁月 提交于 2020-01-15 06:20:08
问题 I am using map on my application, For pin drop, I want to set user's image instead of default pin. I am downloading users image and setting it as per code I paste below. For different scale of devices I am using image name as per device scale like eg., 1 For non retina device - pin.png (size 30 x 30) 2 For retina devices - pin@2x.png (size 60 x 60) 3 For 6+ device - pin@3x.png (size 90 x 90) Here for 1 and 2 working fine and image loads perfect But for 6+ (3x scale) it's not working What's

How to identify when a annotation is pressed which one it is

这一生的挚爱 提交于 2020-01-15 05:13:07
问题 As you can see I've created a new annotation right here var pin = CustomPointAnnotation() pin.coordinate = CLLocationCoordinate2D(latitude: latitude, longitude: longitude) pin.title = "Bus Stop" pin.subtitle = "City Stand D" pin.imageName = "pin" mapView.addAnnotation(pin) Now when a user clicks on the annotation, I want to run a method. But my question is: How do I know which annotation they clicked on? Then the problem is I am using a loop to create multiple annotations so I can't set the

Putting UIButton and other UIControl objects inside an MKAnnotationView and allowing user interaction

牧云@^-^@ 提交于 2020-01-12 07:37:05
问题 I have a custom annotation view on the map, which has a UIButton in it, but the UIButton is not responsive when pressed. I have two main problems with user interaction on the annotation view: Buttons and other controls are not responsive. I want the annotation to block touches according to my implementation of - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent*)event - that is if I return YES then I don't want the touches to get sent through to the MKMapView (potentially selecting other

Clean solution to know which MKAnnotation has been tapped?

对着背影说爱祢 提交于 2020-01-12 05:28:26
问题 Ok, so you typically have some object X you want to be annotated inside a MKMapView. You do this way: DDAnnotation *annotation = [[DDAnnotation alloc] initWithCoordinate: poi.geoLocation.coordinate title: @"My Annotation"]; [_mapView addAnnotation: annotation]; Then you create the annotation view inside - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation; And when some callout gets tapped, you handle the event inside: - (void)mapView:(MKMapView *