mapkit

Updating MKannotation image without flashing

前提是你 提交于 2019-12-03 05:09:50
I want to update the images of some of my annotations on a mapview every 5 seconds, however I dont' want to remove and re-add them to the map as this causes them to 'flash' or refresh, (ie disapear then reappear). I want it to be seamless. I've tried the following: //get the current icon UserAnnotation *annotation = [self GetUserIconWithDeviceId:deviceId]; //make a new annotation for it UserAnnotation *newAnnotation = [[UserAnnotation alloc] initWithCoordinate: userCoordinates addressDictionary:nil]; newAnnotation.title = name; newAnnotation.userDeviceId = deviceId; NSInteger ageIndicator = [

Draw MKPolyline Fill Color

不羁的心 提交于 2019-12-03 04:27:59
I am attempting to draw a nice MKPolyline on an MKPolylineView . Everything is going great so far - the polyline draws just as I want it to and when I want it to using the following code: [[self map] addOverlay:routeLine]; And this method to tell the app how to draw it: - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay { MKOverlayView* overlayView = nil; self.routeLineView = [[MKPolylineView alloc] initWithPolyline:[self routeLine]]; [[self routeLineView] setFillColor:[UIColor colorWithRed:167/255.0f green:210/255.0f blue:244/255.0f alpha:1.0]]; [[self

Animate MapKit annotation coordinate change in Swift?

南楼画角 提交于 2019-12-03 04:17:05
问题 When using MapKit in iOS 8 in Swift, how do I make it possible to animate a change in the map position of a custom annotation? I am saying this: UIView.animateWithDuration(0.25) { var loc = ann.coordinate loc.latitude = loc.latitude + 0.0005 loc.longitude = loc.longitude + 0.001 ann.coordinate = loc } ...where ann is a custom annotation, MyAnnotation. The annotation is jumping, not animating, to the new coordinate position. The annoying thing is that the animation works perfectly if I write

Is there a Google Maps API for iOS which offers traffic information?

本秂侑毒 提交于 2019-12-03 03:48:54
I would like to know if someone has got documentation about the Google Maps API, I'm only looking for the traffic live information I would like to implement it on my iOS application. Does such an API exist? I don't think Google offers a standlone traffic API as of now. However there are a couple options. Render the Google Maps element in a WebView and use the Google JavaScript API to enable the traffic layer. The downside of this approach is that the UX likely wont be as nice as native programming. The upside is less coding. http://code.google.com/apis/maps/documentation/javascript/ http:/

Determining distance using mapkit

安稳与你 提交于 2019-12-03 03:40:28
How is a 1000ft or 1/2 mile distance determined with mapkit? Either a radius from some pin or the distance between two pins. For example, I center the map on pin A. Pins B, C, and D are also on the map at various distances from pin A. B and C are within 1/2 mile from A but D is 1 mile away. I'd like to know that B and C are within 1/2 mile from A. How can I calculate that? Since you've stated that the two different points are "pins", I'm going to assume you're using MKPinAnnotationView (or some other annotation view). If not, you're going to have to get the location some other way. If you have

MKPolyline strange rendering related with zooming in MapKit

送分小仙女□ 提交于 2019-12-03 03:32:30
I have very simple View Controller to demonstrate this strange rendering behavior of MKPolyline. Nothing special just normal api calls. import UIKit import MapKit class ViewController: UIViewController, MKMapViewDelegate { @IBOutlet weak var map: MKMapView! override func viewDidLoad() { super.viewDidLoad() map.delegate = self } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let p1 = CLLocationCoordinate2D(latitude: 51, longitude: 13) var coords = [ p1, CLLocationCoordinate2D(latitude: 51.1, longitude: 13), CLLocationCoordinate2D(latitude: 51.2, longitude: 13),

Show Current User Location with MKMapView?

我只是一个虾纸丫 提交于 2019-12-03 03:18:13
I am trying to show current location of user by setting the property of MKMapView i.e setShowsUserLocation to YES . As by default an arrow appears on the top left of iPhone screen when the application starts updating the user location.But after showing the current location the arrow should disappear but its still present as long as the app is running which would mean the app is still updating the location in the background? so how can i stop updating the current location? i have implemented the delegate which gets called up immediately.. Cyril Godefroy If the map is visible and has

show users location blue point in iPhone MKMapView

99封情书 提交于 2019-12-03 03:13:26
I am developing a custom pins in a MapView in my iPhone app. Here is the code: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *AnnotationViewID = @"annotationViewID"; MKAnnotationView *annotationView = (MKAnnotationView *)[myMapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID]; if (annotationView == nil) { annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID] autorelease]; } if ([[annotation title] isEqualToString:NSLocalizedString(@"Current Location",@""

how to highlight countries in ios maps

馋奶兔 提交于 2019-12-03 02:46:52
问题 I am building an app in which I have to highlight some countries dynamically in the world map. In short I want to customize the whole view of ios maps as shown in the images. can this be done using MapKit or is there any other method. Thanks in advance 回答1: You want to look into the Mapbox iOS SDK which will allow you to do this and more with a MapKit-like API. In particular, you will want to quickly make a custom map with TileMill using the provided Natural Earth data set for world country

Size image pin annotation

 ̄綄美尐妖づ 提交于 2019-12-03 02:39:18
I put the personal image instead of the traditional red pin. When I open the map to display the pin, the image cover the entire map. Is there a maximum size of the pin image or how do I integrate something in the code to fit the size standard classic pin? func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? { if annotation is MKUserLocation { return nil } let annotationIdentifier = "SomeCustomIdentifier" // use something unique that functionally identifies the type of pin var annotationView: MKAnnotationView! = mapView