mapkit

Getting routes and turn-by-turn navigation in an iPhone app

一笑奈何 提交于 2019-12-10 03:29:06
问题 I'm developing an app that will focus heavily on giving users routes and turn-by-turn directions while driving. It is important that they stay within the app during their drive, so I really don't want to make them leave the app and go to the built-in Maps app. I have been doing a lot of research lately on how to include this functionality, and it is widely known that it is not easy, since Apple doesn't include this functionality in the SDK out of the box. It looks like my options are: For

iOS MapKit Changing mapview maptype causes annotation image to change to pin?

百般思念 提交于 2019-12-10 02:25:01
问题 Any suggestions on what is wrong with the following would be appreciated. I am adding a custom image to an annotation using the following code. - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isMemberOfClass:[MKUserLocation class]]) { return nil; } if ([annotation isMemberOfClass:[SpectatorPin class]]) { SpectatorPin *sp = (SpectatorPin *)annotation; MKAnnotationView *view = [self.mapView

Custom annotation showing same image for all different types of POI's

放肆的年华 提交于 2019-12-10 00:32:08
问题 I need to show different annotation for different cat_ID on map. in this question i am including only two categories . let item = json["data"].arrayValue var count = 0 initMK() dispatch_async(dispatch_get_main_queue()) { while count < item.count{ let lat = item[count]["comp_lat"].stringValue let lng = item[count]["comp_lng"].stringValue if item[count]["ct_id"].stringValue == "783"{ self.state = "Jachthavens" let poi = MKPointAnnotation() let coordinates = CLLocationCoordinate2D(latitude:

Enabling and Disabling Annotation Dragging (On The Fly) (iOS Mapkit)

泄露秘密 提交于 2019-12-09 22:32:52
问题 I've created a mapview which has a button to switch between an 'edit' mode and a 'drag' mode based on the project requirements. I realize that it's easy enough to have your annotations draggable from creation by setting them draggable in the viewForAnnotation, but the behavior required won't allow this. I've tried a couple different ways of changing the annotations to draggable without success. The first thought was to loop through the existing annotations and set each one to 'draggable' and

Custom MKAnnotation button

这一生的挚爱 提交于 2019-12-09 22:19:33
问题 I'd like to generate a custom annotation using MKAnnotation . annotationView?.image = UIImage(named: "annotation)") // this is to set the annotation image annotationView?.leftCalloutAccessoryView = UIImageView(image: UIImage(named: "mySymbol")) // this is to add a icon left to the annotation UI The few lines above are working quiet well but ... now I'd like to add a custom button to the Annotation like in the image above. Using the default one is working so far : annotationView?

iPhone SDK: MapKit multiple custom annotations

耗尽温柔 提交于 2019-12-09 22:09:39
问题 I am able to load a big list of location onto my MapKit and display them all with a custom Pin image and annotation. The issue i'm having is that I currently have all annotations displaying the same Title, Subtitle, and pinImage. How do I make it so that I can set each annotation with its own Title and different Pin image? I'm having a hard time trying to identify what annotation is being setup via mapView:viewForAnnotation. - (NSString *)subtitle{ return @"This is the annotation subtitle.";

iPhone Core Location: Calculate total elevation loss/gain

时光怂恿深爱的人放手 提交于 2019-12-09 21:05:04
问题 I am wanting to calculate total elevation loss and gain at the end of recording Core Location data. I am having a hard time thinking of the math for this one. Say if I started at 600 feet and I go up and down during the tracking, how would I calculate my elevation gain and loss? Ideas? 回答1: If you wanted to track gain and loss separately, keep two cumulative member variables, netElevationLoss and netElevationGain, both initialized to 0. - (void)locationManager:(CLLocationManager *)manager

Performance issues with MapKit on iOS6

送分小仙女□ 提交于 2019-12-09 18:40:29
问题 After updating to iOS 6 I have noticed sever performance decreases when panning or zooming a MKMapView with multiple overlays. An app I created has approximately 600 polygon overlays of various colours, and ran lag-free (even on older iOS devices) on iOS 5, now runs extremely laggily (when zooming & panning) on iOS 6, even on the latest devices. My hunch is that this is due to the fact the device has to actually dynamically create the map (since its vector based) rather than just display

MKMapSnapshotter uses incredible amounts of CPU & RAM

笑着哭i 提交于 2019-12-09 15:12:15
问题 MKMapSnapshotter seems to use up to 2GB of RAM when in the simulator, and triggers memory warnings and hangs my app for a very long time on the device. I'm not sure what part of my settings is causing this. This huge usage occurs when retrieving multiple image simultaneously, but even retrieving multiple images one after the other seems to use frankly huge amounts of RAM, 600MB at peak, and fully occupies the CPU, using up to 190%. I've tried removing all other logic, not even saving the

Putting a CLPlacemark on Map in iOS 5

时间秒杀一切 提交于 2019-12-09 09:51:37
问题 In iOS 5, there is a new way to forward geocode address (converting address like 1 Infinite Loop, CA, USA to lat/lang address). More info on this is here. Has anybody tried to put the forward geocoded CLPlacemark object on a MKMapView? I have a CLPlacemark object after geocoding but have no clue how to put it on a map. I would appreciate any type of help. Google is of no help so far. 回答1: In addition to the selected answer, there is also this way for adding annotations to the mapView for