mkpinannotationview

iOS 6 maps- not animating PIN drop

血红的双手。 提交于 2020-01-02 09:11:10
问题 I have created a custom MKAnnotation class and it has been working - until iOS 6 came out. Since then my pins get added to the apple map but now without a drop animation! Is this how it is set or there maybe an an issue with the way I'm doing things. I have set a delay of 1 sec until the method that adds the annotations to the map is called, so I can see if the drop animations are actually occurring before the view appears - still, the pins just appear out of nowhere without dropping. Here's

Dragging the map after dragging my MKAnnotationView does not move the MKAnnotationView with it

两盒软妹~` 提交于 2020-01-01 09:02:50
问题 MKPinAnnotationView does not allow you to use a custom image as 'pin' and enable dragging at the same time, because the image will change back to the default pin as soon as you start dragging. Therefore I use an MKAnnotationView instead of an MKPinAnnotationView. While using MKAnnotationView instead of MKPinAnnotationView does keep your custom image shown as your 'pin' it doesn't support the drag & drop animation that you get with the default pin. Anyway, my issue is that after I drag my

MapView Custom Pin Image Issue

萝らか妹 提交于 2020-01-01 07:26:22
问题 I have changed my MapView pin image but I am getting this problem that some of the point wont change the pin image and some of them change. Where would be the problem? I have added an example. My Code: - (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation { MKPinAnnotationView *pinAnnotation = nil; MKAnnotationView *pinView = nil; if(annotation != locationMap.userLocation) { static NSString *defaultPinID = @"myPin"; pinAnnotation = (MKPinAnnotationView

EXC_BAD_ACCESS with MKPinAnnotationView

泪湿孤枕 提交于 2019-12-31 01:57:08
问题 I have a problem displaying my MKPinAnnotationView on the mapView in iOS. I get this error but i don't understand where the error comes from : "EXC_BAD_ACCESS". My code seems good : -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { MKPinAnnotationView *pv = [[MKPinAnnotationView alloc] init]; [pv setPinColor:MKPinAnnotationColorGreen]; [pv setCanShowCallout:YES]; [pv setRightCalloutAccessoryView:[UIButton buttonWithType

Custom MKPinAnnotationView Colours

无人久伴 提交于 2019-12-25 04:52:41
问题 Is it possible to define custom colours for the MKPinAnnotationView colour rather than the default red, green or purple? Docs say no... Thanks 回答1: If you want to use annotation with color different from standard ones you should create your own image. If Apple's docs say no, you should trust them - even if there's undocumented (using private api) way to do something it will likely cause your app to be rejected from app store. 回答2: Yep. It is possible and doesn't involve any undocumented APIs:

MKPinAnnotationView - different actions in different Pins

筅森魡賤 提交于 2019-12-25 03:36:19
问题 I have a question about the MKPinAnnotationView. First of all I entered coordinates of the pins and after that called the viewForAnnotation to build them and also add them the a right button. But my question is how can I select different actions for those pins? When I look for the button tag in NSLog, it always shows 0 for every pin so I can't make it with tags. Here is the code of the button if it means something: for (int i=0;i<=[[mapview annotations]count];i++) { pinView.tag = i ;

How to capture Tap gesture on MKMapView

筅森魡賤 提交于 2019-12-25 02:15:54
问题 I am trying to capture tap event on my MKMapView , this way I can drop a MKPinAnnotation on the point where user tapped. Basically I have a map overlayed with MKOverlayViews (an overlay showing a building) and I would like to give user more information about that Overlay when they tap on it by dropping a MKPinAnnotaion and showing more information in the callout. Thank you. 回答1: You can use a UIGestureRecognizer to detect touches on the map view. Instead of a single tap, however, I would

Rotate MKAnnotationPinView according to the device heading

笑着哭i 提交于 2019-12-24 13:26:14
问题 In my app I'm rotating the MapView according to the device heading, I have only one annotation and i'm rotating it's pin and it's pinView too. My rotation method is inside the next function - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading { if (newHeading.headingAccuracy < 0) return; CLLocationDirection theHeading = ((newHeading.trueHeading > 0) ? newHeading.trueHeading : newHeading.magneticHeading); lastHeading = theHeading; [self rotateImage:self

How add pin on map?

旧城冷巷雨未停 提交于 2019-12-24 12:05:06
问题 I have a view in which i have a map. On that view i have a tool bar. In tool bar i have a button for drop pin on map. Now i want to get methods for detecting pin drop and latitude and longitude of that point. For example when user click on button then a pin drop on center of map view. And when user click on pin then show title as the address of that point where that pin drop. What function i use for that so that i can set that event on my map view? How do that? Thanks in advance... 回答1: this

Set MKPinAnnotationColorRed just for the first and last MKAnnotation on MKMapView

我的梦境 提交于 2019-12-24 03:19:05
问题 I've an NSArray of custom MKAnnotation , i need to set a red pin color for the first/last annotation, otherwise set a green pin. The program does not behave as i want, the green pins are associated each time with two different annotations in a random way, are not associated with the first and the last as i want. So, this is what i'm doing in my controller: - (void)viewDidLoad { [super viewDidLoad]; //load set a coords from file etc... //self.coordinates is the array of annotations [self.myMap