mkpinannotationview

Should I remove or hide my annotations in MKMapView?

妖精的绣舞 提交于 2019-12-23 09:55:34
问题 I was wondering which would be faster/more efficient when it comes to taking off annotations from the map: hiding or removing. I need to remove and add 100 or so pins every time the user zooms in or out. I can either loop through and hide all annotations using setHidden: , or just remove them using removeAnnotations: . I'm not sure which would be a better method. 回答1: I believe the standard method is to remove them. Less memory overhead. Not that 100 takes up that much, but still better to

MKPinAnnotationView color is not working

 ̄綄美尐妖づ 提交于 2019-12-20 04:30:34
问题 I am trying to show some pins from an array, it shows them all but they are red, and not green as i ask them to be. Why is that ? //run on array to get all locations for(int k=0;k<[array count];k=k+2) { float targetlat=[[array objectAtIndex:k] floatValue]; float targetlongi=[[array objectAtIndex:k+1] floatValue]; CLLocationCoordinate2D location = CLLocationCoordinate2DMake(targetlat,targetlongi); NSString *partyTitle = @"title"; MKPinAnnotationView *partyPin = [self returnPointView:location

MKMapView refresh after pin moves

大城市里の小女人 提交于 2019-12-18 01:18:13
问题 A custom AnnotationView is updated with new coordinates. But the problem is that it visually updates only after some manipulations with MKMapView, e.g. zooming or moving. What should I do to manually update visual position on a map? PS. I've tried to change region to current map's region. But it does change zoom. It's strange. [mapView setRegion:[mapView region] animated:YES]; 回答1: I am a little shoked after hours of research. The answer is just: [mapView setCenterCoordinate:mapView.region

MKPinAnnotationView custom Image is replaced by pin with animating drop

淺唱寂寞╮ 提交于 2019-12-17 16:46:17
问题 I'm displaying user avatar images on a MapView. The avatars appear to be working if they are rendered without animation, however I'd like to animate their drop. If I set pinView.animatesDrop to true, then I lose the avatar and it is replaced by the pin. How can I animate the drop of my avatar without using the pin? Here is my viewForAnnotation method I'm using: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isKindOfClass:

CalloutAccessoryView view for MKPinAnnotationView

…衆ロ難τιáo~ 提交于 2019-12-14 03:22:28
问题 We have rightCalloutAccessoryView and leftCalloutAccessoryView for MKPinAnnotationView but is there if we need to add a custom button to the entire popup bubble how to add it the main requirement is i need to perform same action when we tap on Popup bubble just like disclser Button action. //To add a discloser button to show route map inView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID]; UIButton *detailBtn=[UIButton buttonWithType

How to set MKPinAnnotation so that bottom of image points to location instead of center of image

和自甴很熟 提交于 2019-12-14 03:12:32
问题 How can I move the pin image so that the bottom of the image points to the location (like the default pin). Currently the center of the image points to that location (San Francisco). 回答1: You'll need to calculate the number of pixels to offset and then set the centerOffset property. By default, the center point of an annotation view is placed at the coordinate point of the associated annotation. You can use this property to reposition the annotation view as needed. This x and y offset values

Xcode Annotation from Property List

跟風遠走 提交于 2019-12-13 07:37:08
问题 i know that similar questions have been already asked, but i just could find the answer. So, I'm building an app that has over 100 Pins, writing it into the implementation would be just to much. Does anybody know from your previous experience how can i use the property list file to store coordinates and then read them and place Pins on my map ? What is the best way to do this because i did work with plist files(except editing them). Any tutorials ? 回答1: This is from one of my apps: This is in

Implementing MKPinAnnotationView drag feature?

半城伤御伤魂 提交于 2019-12-12 03:35:19
问题 Can anyone suggest a good tutorial for implementing dragging feature for MKPinAnnotationView in iPhone MKMapView ? 回答1: you can find source code demo for MKPinAnnotationView Drag & drop feature from this link. Update: The Github project link given in above site url is not working. But I found new project example for that from this url. 回答2: To make an annotation draggable, set the annotation view's draggable property to YES. This is normally done in the viewForAnnotation delegate method so

MKMapView iOS custom user location Annotation not showing/updating position

喜夏-厌秋 提交于 2019-12-11 07:20:07
问题 Hi I am using a custom annotation in replacement of the blue GPS position dot. I have added it to the map like so in the viewForAnnotation. OurLocAnnotation class conforms to MKAnnotation delegate. //Custom location view if([annotation isKindOfClass:[OurLocAnnotation class]]) { static NSString *identifier = @"currentLocation"; SVPulsingAnnotationView *pulsingView = (SVPulsingAnnotationView *)[self.recycleMap dequeueReusableAnnotationViewWithIdentifier:identifier]; if(pulsingView == nil) {

Mapview not displaying Title or subtitle from pin annotation

醉酒当歌 提交于 2019-12-10 12:17:19
问题 App returns error when clicking the annotation pin. However it does not crash. It just does not show the title or subtitle. Error is (lldb) then list a string of numbers like 0x3516b5a0. plist example: <dict> <key>cellName</key> <string>Abingdon Lodge No. 48</string> <key>cellSubtitle</key> <string>Abingdon, VA</string> <key>address</key> <string>325 W Main Street Abingdon, Virginia 24210</string> <key>latitude</key> <real>36.708649</real> <key>longitude</key> <real>-81.981184</real> <key