userlocation

How do I remove all annotations from MKMapView except the user location annotation?

廉价感情. 提交于 2019-11-28 19:39:53
问题 I use removeAnnotations to remove my annotations from mapView but same it remove user location ann. How can I prevent this, or how to get user ann back to view? NSArray *annotationsOnMap = mapView.annotations; [mapView removeAnnotations:annotationsOnMap]; 回答1: Update: When I tried with the iOS 9 SDK the user annotation is no longer removed. You can simply use mapView.removeAnnotations(mapView.annotations) Historical answer (for apps that run on iOS before iOS 9): Try this: NSMutableArray *

Sort array by distance near user location from firebase

天大地大妈咪最大 提交于 2019-11-28 02:21:41
问题 Can't figure out how to do automatic sorting addresses near the user. I can not understand where to start and how to write code. I have addresses in my firebase . Addresses have type string (not latitude / longitude). Example: "Москва, Электрозаводская, 21" "Москва, Арбат, Староконюшенный переулок, дом 43" "Москва, улица 1-я Бухвостова, дом 12/11, корпус 53" I know what need use query from firebase, but how use query , i don't understand now. It's my code: class PhotoStudiosViewController:

Getting 0.0 for latitude and longitude while showing current location in map

隐身守侯 提交于 2019-11-28 01:16:41
I am using the following code to get my current location. But the problem I am facing is, it always returns 0.0 for latitude and longitude. I have turned on the GPS settings in the phone and set all the permissions. But still I am facing this. locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); customLocationListener = new CustomLocationListener(); locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, customLocationListener); class CustomLocationListener implements LocationListener{ ............ public void onLocationChanged(Location argLocation

How to change MKMapView's user-location blue dot to an image of choice?

∥☆過路亽.° 提交于 2019-11-27 11:02:45
Is it possible to change the blue dot which indicates the user's location in MKMapView to an image? For example a little car or any .png image? EmptyStack In the viewForAnnotation: method of MKMapViewDelegate probably you would be having the code like this. - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if (annotation == mapView.userLocation) return nil; ... We return nil if the annotation is userLocation to let the mapView display the blue dot & circle animation. In order to show our custom annotation for userLocation just remove the line

Getting 0.0 for latitude and longitude while showing current location in map

无人久伴 提交于 2019-11-27 04:46:34
问题 I am using the following code to get my current location. But the problem I am facing is, it always returns 0.0 for latitude and longitude. I have turned on the GPS settings in the phone and set all the permissions. But still I am facing this. locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); customLocationListener = new CustomLocationListener(); locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, customLocationListener); class

How to change MKMapView&#39;s user-location blue dot to an image of choice?

别说谁变了你拦得住时间么 提交于 2019-11-26 15:24:16
问题 Is it possible to change the blue dot which indicates the user's location in MKMapView to an image? For example a little car or any .png image? 回答1: In the viewForAnnotation: method of MKMapViewDelegate probably you would be having the code like this. - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if (annotation == mapView.userLocation) return nil; ... We return nil if the annotation is userLocation to let the mapView display the blue dot