mkoverlay

Custom “Callouts” for MKPolyline

↘锁芯ラ 提交于 2019-12-22 11:33:12
问题 I have an app to which I display routes on a map as MKPolyline. I made my search but I was unable to find a sample code on how to display custom MKPolyline callouts as Apple does on the ios6 maps: Can some help me? Thank you in advance.. 回答1: This appears to be The definive solution at the moment http://navarra.ca/?p=786 from this Question drawing routes on MKMapView 来源: https://stackoverflow.com/questions/16122833/custom-callouts-for-mkpolyline

Two coloured/custom line on MKPolylineRenderer

可紊 提交于 2019-12-21 20:38:00
问题 I am drawing x amount of lines on an MKMapView . The data is being downloaded from a webservice and for each line that needs drawing I am creating a MKPolyline , adding it to an overlayArray (some overlays have more than one polyline) and finally adding that overlay to the map via: [self.mapView addOverlays:overlayArray];` The next function is therefore called which works wonderfully: - (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay { if (![overlay

Change coordinate of MKOverlay for an MKOverlayView

心已入冬 提交于 2019-12-21 04:35:07
问题 I have an overlay on the map, and I would like to change its coordinates. To do this seamlessly I'm going to call the setNeedsDisplayInMapRect: method after the change has been made to the view. I've tested this out by just changing the fillColor and it works fine: overlayView.fillColor = [[UIColor greenColor] colorWithAlphaComponent:0.3]; [overlayView setNeedsDisplayInMapRect:mapView.visibleMapRect]; However I've seemingly hit a brick wall trying to also change the center coordinates of my

Hiding mapview when mapoverlay is visible ios7

烂漫一生 提交于 2019-12-19 11:27:03
问题 How do I hide the mapview when I have an overlay on top of the mapview in iOS7? This snippet of code used to work in iOS6 but when i upgrade my app to iOS7 it cease to work. NSArray *views = [[[self.mapView subviews] objectAtIndex:0] subviews]; [[views objectAtIndex:0] setHidden:YES]; Any suggestions or feedback? 回答1: With what incanus said with MKTileOverlay , it is like this in the view controller: - (void)viewDidLoad { [super viewDidLoad]; NSString *tileTemplate = @"http://tile.stamen.com

How do I show MKOverlay above MKAnnotations?

元气小坏坏 提交于 2019-12-19 06:18:08
问题 I'm trying to use an MKOverlay (specifically an MKPolyline ) to show a route on the map. However, I need the route to show up above my existing pins (custom MKAnnotationView s). Is there a good way to bring the MKPolyline to the front above the pins? 回答1: It might be useful to investigate the annotation layer's zOrder property. Sending the annotations backwards in your superview's hierarchy may help you achieve the effect needed. Changing your annotation z-axis position should probably be

Custom MKOverlayView line width

与世无争的帅哥 提交于 2019-12-18 04:23:09
问题 I have a custom MKOverlayView, which draws a simple line. In drawMapRect: I am setting CGContextSetLineWidth(context, 30); This looks fine when completely zoomed in, but when you zoom out, the line becomes more and more thin. The MKOverlayView reference says that it automatically scales to the map's zoom level. How can I force it to draw the same width no matter what my zoom level? I notice that MKPolylineView (and MKPolygonView) do this correctly... you can see the line's width resize

Is there a way to add text using Paths Drawing

北城余情 提交于 2019-12-17 09:47:51
问题 I have a map custom view that inherit from MKOverlayPathView. I need this custom view to display circle, line and text. I already managed to draw circle and line using path drawing CGPathAddArc and CGPathAddLineToPoint functions. However, I still need to add text. I tried to add text using [text drawAtPoint:centerPoint withFont:font]; but I got invalid context error. any idea? 回答1: With MKOverlayPathView , I think the easiest way to add text is to override drawMapRect:zoomScale:inContext: and

Draw text in circle overlay

冷暖自知 提交于 2019-12-17 07:37:34
问题 I'm trying to draw some circle overlays containing text on MKMapView. I have subclassed the MKCircleView, in which I put the following (based on this), but the text does not appear. The circles show up correctly. (Also tried the first response's solution, same result). -(void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context { [super drawMapRect:mapRect zoomScale:zoomScale inContext:context]; NSString * t= @"XXXXX\nXXXX" ; UIGraphicsPushContext

Animated gif not working in MKMapView overlay using MKOverlayRenderer

≡放荡痞女 提交于 2019-12-17 06:45:31
问题 I am trying to display an animated gif in an overlay for MKMapView . The overlay is created using the MKOverlayRenderer . To animate the gif in iOS 7, I'm using the UIImage+animatedGIF category posted here on GitHub. The image of the animated gif displays fine in the overlay using the category; however, the gif does not animate. I have no problem using the category to animate a gif in a UIImageView but it does not seem to work correctly in a map view overlay. How can I use this category to

MKOverlayView performance

不问归期 提交于 2019-12-12 17:13:27
问题 I am adding about 3000 MKOverlays to my map, and as you can imagine, it takes a while, up to about eight seconds sometimes. I'm looking for a way to use threading to improve performance, so the user can move the map around while overlays are being added. Preferably, the overlays would be added sequentially, starting with the just the ones within the map's region. I have tried something along these lines with GCD: - (MKOverlayView*)mapView:(MKMapView*)mapView viewForOverlay:(id)overlay { _