mkoverlay

Add inverted circle overlay to map view

☆樱花仙子☆ 提交于 2019-11-27 13:11:26
问题 (Using iOS 5 and Xcode 4.2.) I've followed the instructions here: http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/AnnotatingMaps/AnnotatingMaps.html#//apple_ref/doc/uid/TP40009497-CH6-SW15 and used the MKCircle and MKCircleView classes to add a circle overlay on my MKMapView. However what I actually want is an inverted circle overlay, like the left map in the sketch below (currently I have a circle overlay like the one on the right): For the

Is there a way to add text using Paths Drawing

痴心易碎 提交于 2019-11-27 08:47:30
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? With MKOverlayPathView , I think the easiest way to add text is to override drawMapRect:zoomScale:inContext: and put the path and text drawing there (and do nothing in or don't implement createPath ). But if you're going

How to capture Tap gesture on MKMapView

孤街浪徒 提交于 2019-11-27 06:45:01
I am trying to capture tap event on my MKMapView , this way I can drop a MKPinAnnotation on the point where user tapped. Basically I have a map overlayed with MKOverlayViews (an overlay showing a building) and I would like to give user more information about that Overlay when they tap on it by dropping a MKPinAnnotaion and showing more information in the callout. Thank you. You can use a UIGestureRecognizer to detect touches on the map view. Instead of a single tap, however, I would suggest looking for a double tap ( UITapGestureRecognizer ) or a long press ( UILongPressGestureRecognizer ). A

Draw text in circle overlay

戏子无情 提交于 2019-11-27 05:06: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(context); CGContextSaveGState(context); [[UIColor redColor] set]; CGRect overallCGRect = [self

Draw a circle of 1000m radius around users location in MKMapView

自作多情 提交于 2019-11-27 02:51:16
(Using iOS 5 and Xcode 4.2) I have an MKMapView and want to draw a circle of 1000m radius around the user location. On the surface it would seem that implementing the mapView:viewForAnnotation: map view delegate method, and adding a custom MKAnnotationView for the users location, would be a perfect solution. It would look something like this: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { // If it's the user location, return my custom MKAnnotationView. if ([annotation isKindOfClass:[MKUserLocation class]]) { return myCustomAnnotationView; }

Animated gif not working in MKMapView overlay using MKOverlayRenderer

允我心安 提交于 2019-11-27 01:46:48
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 place an animated gif in a map view overlay? or... Is there a way to place a UIImageView in the overlay

Detecting touches on MKOverlay in iOS7 (MKOverlayRenderer)

六月ゝ 毕业季﹏ 提交于 2019-11-26 19:29:54
问题 I have an MKMapView with possibly hundreds of polygons drawn. Using MKPolygon and MKPolygonRenderer as one is suppose to on iOS7. What I need is a way of acting upon the user touching one of the polygons. They represent an area on the map with a certain population density for example. On iOS6 the MKOverlays were drawn as MKOverlayViews so touch detection was more straightforward. Now using renderers I don't really see how this is suppose to be done. I'm not sure this will help or is even

How to capture Tap gesture on MKMapView

你。 提交于 2019-11-26 12:09:17
问题 I am trying to capture tap event on my MKMapView , this way I can drop a MKPinAnnotation on the point where user tapped. Basically I have a map overlayed with MKOverlayViews (an overlay showing a building) and I would like to give user more information about that Overlay when they tap on it by dropping a MKPinAnnotaion and showing more information in the callout. Thank you. 回答1: You can use a UIGestureRecognizer to detect touches on the map view. Instead of a single tap, however, I would