mkannotation

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

Moving annotations in MKMapView according to server data (latitude and longitude)

被刻印的时光 ゝ 提交于 2019-12-31 00:48:28
问题 In my app I am showing location of some other person by getting their location (latitude and longitude) from server at particular interval. After getting I have to remove all annotations and drop new annotations based on the server data. But it looks very inefficient as when we have the annotation for the same user previously exists even then I'm removing and adding the same user annotation. So I want to know can we move the MKAnnotation from one coordinate to other? I have tried

how to set up array for multi annotations with swift

梦想与她 提交于 2019-12-30 01:20:25
问题 How should the array below be set. Im trying to add multiple annotations onto my map. I was able to find the code below on stackoverflow but they did not show how to set up the array. var objects = [ //how should the array be setup here ] for objecters in objects!{ if let latit = objecters["Coordinates"]["Latitude"]{ self.latitudepoint = latit as! String self.map.reloadInputViews() } else { continue } if let longi = objecters["Coordinates"]["Longitude"]{ self.longitudepoint = longi as! String

How to go to second view controller after click on disclosure indicator button

[亡魂溺海] 提交于 2019-12-29 09:34:36
问题 I would like to remove existing annotation from mapview. Scenerio is to click on existing annotation callout part (disclosureindicator button) and it would lead user to another viewcontroller and shows a button you could remove the selected annotation. Actually, I am working on to create exactly same google map application, that is part I am struggling now. Any help would be appreciated! 回答1: The MKMapView class has two methods you need to add/remove annotations: addAnnotation: id

Adding a route to a MKMapView

℡╲_俬逩灬. 提交于 2019-12-29 07:08:43
问题 I'm trying to add a routing feature to an app I'm working on. I found Craig Spitzkoff's article on how to draw lines on an MKMapView which works pretty good. But since I don't have the coordinates of the points on the roads that doesn't help me as expected. Is there any way to determine the coordinates between to given points, say my current position and another address? 回答1: Basically you will need to make an HTTP request to the Google Directions API. The terms of service state that you have

How to find map annotations that fit my criteria

你说的曾经没有我的故事 提交于 2019-12-25 17:19:53
问题 I have a MapView with user location, and a bunch of Map annotations. At first I want to show all the possible pins on the map. (succeeded in doing that) Then I want to zoom in the map to show only the annotations that are within 50 KMs away from the userLocation annotation How do i find these annotations? 回答1: - (CLLocation*)closestLocationToLocation:(CLLocation*)currLocation { CLLocationDistance minDistance; CLLocation *closestLocation = nil; for (CLLocation *location in arrayOfLocations) {

Seeing MKAnnotation Coordinates During Drag

女生的网名这么多〃 提交于 2019-12-25 03:14:11
问题 I want to be able to track the coordinates of my MKAnnotation as I drag it. Currently, I am only getting the coordinates as the drag begins. I have tried implementing a custom MKAnnotationView subclass with touchesMoved , however this appears not to work. (As suggested here: Obtaining MKAnnotation's coordinate while dragging.) By receiving the new coordinates as I drag my annotation, I will in turn be able to update my polygon shape. 回答1: You can track the coordinates from MKAnnotationView .

How to put a button on a Map in Iphone

百般思念 提交于 2019-12-24 20:16:02
问题 i am trying to pull a map in my applcation with interface builder using MKMapView but for some reason its not showing up. Also i want to add some button to this view by clicking which i can browse a file existing in my iphone. Please provide me with the detial description as i am new to this. Thanks, 回答1: You'll want to add an annotation to the map, then provide a custom view for it. To add an annotation to the map, adopt the MKAnnotation protocol in one of your objects and set its coordinate

add id to pin annotation in objective c to load detailview

六眼飞鱼酱① 提交于 2019-12-24 15:09:42
问题 I have a mapview controller which shows pins from an array of business objects I have created (each business has a method to get the title and subtitle of the pin). I have added a disclosure button to each pin annotation which works correctly, but I am not sure how to pass a variable to the detail view which is to be loaded from the disclosure button, and show all the details for that particular business. I add my businesses to the array like this (in viewWillAppear)... // fetch model data

Custom annotations with same image

醉酒当歌 提交于 2019-12-24 11:44:38
问题 As you can see in the image below that all annotations have same image and discount which is not correct, they should have different image and discount . How can I fix this? I am using a custom annotation class with discountStr and 'imgPathStr' property and the following code. -(void) connectionDidFinishLoading: (NSURLConnection *) connection { [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; _adResultDict = [NSJSONSerialization JSONObjectWithData:_adResultData options