mkmapview

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

Multiple Arrays of Annotations, Different Pin Color for Each Array?

微笑、不失礼 提交于 2020-01-01 07:05:52
问题 I have three arrays of annotations in my app, foodannotations, gasannotations, and shoppingannotations. I want each array of annotations to show a different colored pin. I am currently using - (MKAnnotationView *)mapView:(MKMapView *)sheratonmap viewForAnnotation:(id<MKAnnotation>)annotation { NSLog(@"Welcome to the Map View Annotation"); if([annotation isKindOfClass:[MKUserLocation class]]) return nil; static NSString* AnnotationIdentifier = @"Annotation Identifier"; MKPinAnnotationView*

Filtering compass readings

随声附和 提交于 2020-01-01 05:40:12
问题 I'm using compass heading to rotate an MKMapView. The rotation was a bit jerky so I'm trying to filter it like Google Maps on the iphone does (or appears to do some trickery). I'm trying to filter the reading from the iphone compass using a moving average formula but it fails on the crossover between 359 adn 0 becuase it starts to average backwards from 35x to 0 and causes the map to rotate backwards as it approaches north from the west. Any ideas what the best way is to filter this data so

How can i integrate Radar Overlay on MapView?

房东的猫 提交于 2020-01-01 05:00:09
问题 I want to Integrate Weather radar on my MapView.Please anyone help on doing this task.I have done so many googling but not get succeed.Please check this image i wanted to do like this. 回答1: You need investigate MapKit overlays (MKOverlay). In your case you will be creating a MKPolygon . You will need to create an array of MKMapPoints from your weather radar data, then create a MKPolygon from these points and add it your map as an overlay. There is a sample Apple project called HazardMap which

CLLocation distanceFromLocation

折月煮酒 提交于 2020-01-01 03:36:05
问题 I am using CLLocation to work out the distance from the current user location, and an annotation. However I just wanted to know if this would be correct. I am currently using iPhone Simulator for this and according to the MKMapView the iPhone Simulator is situated here: Lat: 0 Long: -1067024384 The annotation's position is: workingCoordinate.latitude = 40.763856; workingCoordinate.longitude = -73.973034; However if you take a look in google maps you will find out how close these distances are

How to dismissPopoverAnimated on iPad with UIPopoverController in MKMapView (SDK3.2)

痞子三分冷 提交于 2020-01-01 02:41:08
问题 I have a MKMapView (also a UIPopoverControllerDelegate) with Annotations. This MapView has, in the MKTestMapView.h file, a UIPopoverController* popoverController defined in the @interface and a @property (nonatomic, retain) UIPopoverController* popoverController; defined outside of the @interface section. This controller is @synthesized in the MKTestMapView.m file and it is released in the - (void)dealloc section. The Annotations in this MapView have rightCalloutAccessoryView s defined to the

MKMapView with address

元气小坏坏 提交于 2019-12-31 20:43:07
问题 is there a way to make the MKMapView place a pin with a given address? Without using the Coordinates Thanks 回答1: here is a snippet of code I used in an application -(CLLocationCoordinate2D) getLocationFromAddressString:(NSString*) addressStr { NSString *urlStr = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv", [addressStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSString *locationStr = [NSString stringWithContentsOfURL:[NSURL

iOS: Notification when MKMapView is loaded and annotations/overlays are added?

我只是一个虾纸丫 提交于 2019-12-31 18:42:29
问题 I am aware of the delegate methods used to let me know when the map has loaded and annotations and overlays have been added. ( mapViewDidFinishLoadingMap: mapView:didAddAnnotationViews: mapView:didAddOverlayViews: ) I am wanting to create a UIImage from my MKMapView once everything has loaded. Currently I am creating my UIImage once mapView:didAddOverlayViews: is called, but this is not always reliable, because sometimes the overlay take longer to be added, sometimes

How to center my current location in MKMapView?

跟風遠走 提交于 2019-12-31 08:53:07
问题 I am showing the current location in MKMapView by using showUserLocation enables. I also want to center the mapview to the user current location and also the zoomed map of location. Please help me regarding this as I don't get any help from other similar questions on stackoverflow. My code is below: - (void)viewDidLoad { [super viewDidLoad]; [mapView setMapType:MKMapTypeStandard]; [mapView setZoomEnabled:YES]; [mapView setScrollEnabled:YES]; [mapView setCenterCoordinate:mapView.userLocation