mapkit

Draw a path between two coordinates in MapView (iOS) [duplicate]

旧巷老猫 提交于 2019-12-08 06:49:54
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Show route between current and desired location on iPhone MapView I am trying to draw a path between two coordinates on a MapView in iOS, but I can't figure out how. I have the two latitude and longitude points in one view. How can I draw the path between these two points? I've attached the example with this question. Please help me. Any tutorials and code will be appreciated! 回答1: A simple answer is; you can't.

Create multiple MKOverlays of polyline from locations coming via web-service

落花浮王杯 提交于 2019-12-08 06:35:27
My app is real-time tracker, where multiple users are logged in and updating their location by sending their co-ordinates to our web service which is then called back let's after every 2 minutes to show all the users on my MapView . Every time I get the locations of users from web service in connectionDidFinishLoading method, I am parsing, creating polyline through pointsArray and adding them to overlay : -(void) connectionDidFinishLoading: (NSURLConnection *) connection { userLatitudeArray = [[NSMutableArray alloc]init]; userLongitudeArray = [[NSMutableArray alloc]init]; userIdArray = [

How to change non selected annotation pin images on mapkit with Swift

巧了我就是萌 提交于 2019-12-08 06:33:46
问题 I have a map and on this map I have 10 custom annotation pins. All pins have same custom image. When i click on a pin, i need to change all other 9 annotation's images. its possible to change clicked pin's image but i need to keep as it is and i need to change all other pins images. I tried to get all annotations with Map mapView.annotations and tried to find selected annotation and change others images but couldnt manage it. And idea how to do it? Thanks in advice 回答1: Conform to

Customize MGLPolyline using mapbox

南楼画角 提交于 2019-12-08 06:32:47
问题 Just started using Mapbox, managed to draw a MGLPolyline by adding this in the locationManaged didUpdateLocations var shape = MGLPolyline(coordinates: &a, count: UInt(a.count)) mapView.addAnnotation(shape) Changing the line width doesn't change it on the screen func mapView(mapView: MGLMapView, lineWidthForPolylineAnnotation annotation: MGLPolyline) -> CGFloat { return 20.0 } How do I change the stroke default color from black to something else? 回答1: You need to set the map delegate to self

IPhone SDK MapKIt Multiple Points and Annotation

有些话、适合烂在心里 提交于 2019-12-08 06:32:35
问题 I am new to IPhone SDK Development i am trying to make an application with MapKit i have done the first bit i want to add multiple pins and annotation to the application but i am lost here. Following is the code how can i add more pins to this code -(void)viewDidLoad{ [super viewDidLoad]; [mapView setMapType:MKMapTypeStandard]; [mapView setZoomEnabled:YES]; [mapView setScrollEnabled:YES]; MKCoordinateRegion region={{0.0,0.0,},{0.0,0.0}}; region.center.latitude = 26.438047; region.center

CLLocationManager in background thread

南楼画角 提交于 2019-12-08 06:21:26
I am doing one application.In that i am using the CLLocationManager Class for getting the updated location latitude and longitude details.But i need to use this CLLocationManager in sepaate thread .I written my code like below. - (void)viewDidLoad { [NSThread detachNewThreadSelector:@selector(fetch) toTarget:self withObject:nil]; } -(void)fetch { manager=[[CLLocationManager alloc]init]; manager.delegate=self; manager.distanceFilter=kCLDistanceFilterNone; manager.desiredAccuracy = kCLLocationAccuracyBest; [manager startUpdatingLocation]; } - (void)locationManager:(CLLocationManager *)manager

Adding MKOverlayPathRenderer as overlay to MKMapView gets exception

╄→尐↘猪︶ㄣ 提交于 2019-12-08 05:57:53
问题 Everything said in topic, so here is the code - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. _pathRenderer = [[MKOverlayPathRenderer alloc] init]; _pathRenderer.lineWidth = 8.0f; _pathRenderer.strokeColor = [UIColor redColor]; _pathRenderer.path = CGPathCreateMutable(); [_mapView addOverlay:_pathRenderer]; } At the last line it drops with exception: Terminating app due to uncaught exception 'NSInvalidArgumentException',

Draw polyline in mapview iOS 6

﹥>﹥吖頭↗ 提交于 2019-12-08 05:45:37
问题 Hi I'm doing an app that must to show a map with the route. I parsed a Json to obtain the points to draw the polyline. I found a a code in the web to draw this polyline. The code I found it's on this link: http://iosguy.com/2012/05/22/tracing-routes-with-mapkit/ Where it says "Create the MKPolyline annotation" I tried to import this in my app, but I'm having problems to create the array of the coordinates. My method is this: - (void)createMKpolylineAnnotation { NSInteger numberOfSteps = self

Controls in a ViewController losing their state after memory warning while off screen

假如想象 提交于 2019-12-08 05:40:20
问题 The situation is very similar to that described by this my other question, except that the delegation seems to work fine. I'm providing some more detail about my code. I'm just striping out non-relevant/trivial parts. ReportScreen.h @interface ReportScreen : UIViewController <UIImagePickerControllerDelegate, UITextViewDelegate, MBProgressHUDDelegate, SoapDelegate, MapLocationChoiceDelegate> // ... @property (nonatomic, retain) MKPointAnnotation *annotation; @property (nonatomic, retain)

Customize MGLPolyline using mapbox

為{幸葍}努か 提交于 2019-12-08 05:02:30
Just started using Mapbox, managed to draw a MGLPolyline by adding this in the locationManaged didUpdateLocations var shape = MGLPolyline(coordinates: &a, count: UInt(a.count)) mapView.addAnnotation(shape) Changing the line width doesn't change it on the screen func mapView(mapView: MGLMapView, lineWidthForPolylineAnnotation annotation: MGLPolyline) -> CGFloat { return 20.0 } How do I change the stroke default color from black to something else? You need to set the map delegate to self for the functions to work. Here is the code: Initiate your viewController with MGLMapViewDelegate class