mkmapview

How to use MKLocalSearch In MKMapView

会有一股神秘感。 提交于 2019-12-12 00:15:46
问题 i am using MKLocalSearch in MKMapView..I am implementing as follow extension MYClass: SendLocationDelegate{ func sendCoOrdinates(loccoordinate:CLLocation, placemark:CLPlacemark){ println(" Google VC coordinate is as \(loccoordinate.coordinate.longitude) \(loccoordinate.coordinate.latitude)") let location:CLLocationCoordinate2D = CLLocationCoordinate2D(latitude:loccoordinate.coordinate.latitude, longitude: loccoordinate.coordinate.longitude) let theSpan : MKCoordinateSpan = MKCoordinateSpan

How can I center my mapview so that the selected pin is not in the middle of the map but in 1/3 of it?

喜欢而已 提交于 2019-12-12 00:02:50
问题 I have coordinates of a single pin on my map. I try to center my map on that pin, but I don't want to keep the pin directly in the middle of the map, but in 1/3 of the screen. I tried to do it in the following workaround: let coordinateRegion = MKCoordinateRegionMakeWithDistance(coordinatesOfThePin, 500, 500) mapView.setRegion(coordinateRegion, animated: true) let frame = mapView.frame let myPoint = CGPointMake(frame.midX, frame.midY/3) let myCoordinate = mapView.convertPoint(myPoint,

Creating Custom Call out View with button on it

匆匆过客 提交于 2019-12-11 21:52:54
问题 I am stuck with a map View problem for which I was surfing the internet from the last three days but still not find any appropiate solution. My problem is When I click on my pin which is customized, a callout appears. But standard callout support only two lines text.In my case I have to show four lines text with a button. Please any one tell me how to create a custom callout or what approach should I use as there is no way to modify the standard callout. Any suggestions would be highly

MKMapView get distance between coordinates on customized route

青春壹個敷衍的年華 提交于 2019-12-11 20:25:17
问题 I have a custom route on map and want to get the distance between two coordinates on MKMapView . Below are the steps I have done so far... I have grabbed coordinate points and prepared an array of CLLocationCoordinate2D (like, customRoute = [CLLocationCoordinate2D] ). To show the route, using array of coordinates, I have drawn MKPolyline using MKOverlay method. And calculating the distance between two coordinates using distanceFromLocation method. When I calculate distance, the resulting

Annotated pins are not getting loaded during reloading of map

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 20:03:17
问题 I have used apple maps in my application for implementing maps.I used the following code for that. My problem is that,It is showing the pins only when it is loading for the first time. I have written the code like this - (void)viewDidLoad { [super viewDidLoad]; self.title = @"Locate Engineer"; [worldView setMapType:MKMapTypeStandard]; [worldView setShowsUserLocation:YES]; worldView.delegate = self; } - (void)viewDidUnload { [super viewDidUnload]; } -(id)initWithNibName:(NSString *

Changing pin color when selecting annotation pin

爱⌒轻易说出口 提交于 2019-12-11 19:19:02
问题 My app is a map view where the user can enter an address which will put a purple pin on the map for the HQ. Secondly, the user can enter any address, which will put a red pin on the map. I would like to be able to change the pin color of the red pins to either red, green, or purple. I stumbled across a tutorial that will allow the user to select an annotation pin and change its pin color by displaying a modal view. I followed the tutorial meticulously, but for some reason, it is not working

Determine which MKPinAnnotationView was selected?

霸气de小男生 提交于 2019-12-11 19:17:57
问题 I place some custom MKPinAnnotationView on the map, with different information about landmarks (name, description, image, accessory button). When a user click and open one of the pins, and then click the accessory button inside it, I want to know which of the pins the user have clicked so I can load a viewcontroller with more detailed information. I found these methods: - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *

How to add image in annotation in mkmap [duplicate]

二次信任 提交于 2019-12-11 18:38:35
问题 This question already has answers here : How to use custom icons with mapKit framework? (2 answers) Closed 5 years ago . I am new to Xcode, i need to set the image in annotation point. I am trying to replace the typical iOS mapkit "pin" with a particular image. I'm new to coding so I'm not sure exactly why this isn't working, but here is what i've attempted My code is - (void)viewDidLoad { [super viewDidLoad]; NSString *urlMapString=[NSString stringWithFormat:@"http://www.xxxx.com/xxxx

Why are my annotations not appearing in my map view?

南笙酒味 提交于 2019-12-11 18:08:54
问题 I have created a set of "IssueLocation"'s, a class which conforms to the MKAnnotation protocol. Why are my annotations (built from API JSON data) not appearing in my map view ? Here is the code behind it all: Class code: class IssueLocation: NSObject, MKAnnotation { var locationName: String var campusName: String var latitude: Double var longitude: Double var coordinate: CLLocationCoordinate2D init(locationName: String, campusName: String, latitude: Double, longitude: Double, coordinate:

How can can I get equidistant location on a MKPolyline?

大城市里の小女人 提交于 2019-12-11 18:07:17
问题 I need to find equidistant locations on a MKPolyline to add annotations as shown below. My function to get locations on MKPolyline is given below, I have the values start and end coordinates of Polyline. But the locations are slightly ,moving out of polyline as shown in the image below My function to find location is func getEquidistantPoints(from startPoint: CLLocationCoordinate2D, to endPoint: CLLocationCoordinate2D, numberOfPoints: Int) -> [CLLocationCoordinate2D] { var midPoints: