mkoverlay

Custom “Callouts” for MKPolyline

随声附和 提交于 2019-12-06 12:37:09
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.. Mindeater 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

Trouble with overlay using MKPolyline & MKPolylineView

笑着哭i 提交于 2019-12-06 11:01:32
I have added an overlay to my MKMapView using the addOverlay: method. The overlay was made using MKPolyline and stroked using MKPolylineView. The stroke color is blue, with an alpha value of 0.7. When the view initially loads, the overlay is drawn correctly but the surrounding areas of the overlay are blue as well... When I pinch & zoom out, the blue area is still there but it adjusts to my new zoom level. This is somewhat hard to describe... but basically I have a small rectangle of "normal map" trapped inside a larger rectangle that is blue. It will disappear when I zoom out to view the

Draw polyline between given points on the map

纵然是瞬间 提交于 2019-12-06 09:43:27
I am implementing an iOS application, and I want to draw a polyline between several given coordinates on the map. I wrote the code and got the polylines being drawn from my point reaching an infinite point. In other words the beginning point of the line starts from the my given lat and long point, but the end of the line is infinite and not the other point. This is my code... I filled the coordinates in a NSMutableArray called routeLatitudes . The array cells are being filled one for latitude and one for longitude. MKMapPoint* pointArr = malloc(sizeof(CLLocationCoordinate2D) * [routeLatitudes

How to distinguish two MKPolyline's in viewForOverlay:

这一生的挚爱 提交于 2019-12-06 07:12:29
问题 I am loading multiple MKPolylines as overlays onto an MKMapView . I would like to be able to distinguish these some how so change things like color, line width, etc. But, when viewForOverlay: gets called, it sees all my MKPolylines the same, which doesn't allow me to change any of them. - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay { if ([overlay isKindOfClass:[MKPolyline class]]) { MKPolylineView *aView = [[[MKPolylineView alloc] initWithPolyline:

How to: Display MKOverlay on MKMapView

为君一笑 提交于 2019-12-05 07:00:40
I need to display an MKOverlay on a map, but can't get it to actually appear. I'm following the example from Apple's Location Awareness Programming Guide and the overlay wont display. Any help would be greatly appreciated, this is the first iPhone app I've made, so I might be missing something simple. NavViewController.h #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface NavViewController : UIViewController <MKMapViewDelegate> { } @property (weak, nonatomic) IBOutlet MKMapView *mapView; @end NavViewController.m #import "MSUNavViewController.h" #import <CoreLocation/CoreLocation.h> -

Convert MKCircle Radius to CoreGraphics Arc Radius

不想你离开。 提交于 2019-12-04 18:45:48
How can I convert an MKCircle's radius (in meters) into a value I can use to draw a circle using core graphics in an MKOverlayPathView subclass? In the following code the radius is hardcoded to 50 but I need it to reflect the radius of the MKCircle. For the position I use MKMapPointForCoordinate() to convert the MKCircle's coordinate to an MKMapPoint, then convert the MKMapPoint to a point using MKOverlayPathView's pointForMapPoint:. But how can I convert the MKCircle's radius into a relative distance? MKCircle *circle = [self circleForLocation:location]; CGPoint relativePoint = [self

Custom map path line

若如初见. 提交于 2019-12-04 16:03:12
I'm having trouble with drawing a line on the map with a stroke. (inside color and outside color) I beleive i'm on the right path and have subclassed mkOverlayView to override the drawing (needs to fill with the road size) so inside drawMapRect... CGFloat lineWidth = MKRoadWidthAtZoomScale(zoomScale); MKMapRect clipRect = MKMapRectInset(mapRect, -lineWidth, -lineWidth); ... CGContextAddPath(context, path); CGContextSetStrokeColorWithColor(context, line.color.CGColor); CGContextSetLineJoin(context, kCGLineJoinRound); CGContextSetLineCap(context, kCGLineCapRound); CGContextSetLineWidth(context,

How to distinguish two MKPolyline's in viewForOverlay:

我怕爱的太早我们不能终老 提交于 2019-12-04 14:34:51
I am loading multiple MKPolylines as overlays onto an MKMapView . I would like to be able to distinguish these some how so change things like color, line width, etc. But, when viewForOverlay: gets called, it sees all my MKPolylines the same, which doesn't allow me to change any of them. - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay { if ([overlay isKindOfClass:[MKPolyline class]]) { MKPolylineView *aView = [[[MKPolylineView alloc] initWithPolyline:(MKPolyline*)overlay] autorelease]; aView.strokeColor = [[UIColor blueColor] colorWithAlphaComponent:0.7];

Performance issues with MapKit on iOS6

前提是你 提交于 2019-12-04 09:20:49
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 tiles onscreen. Has anyone got any ideas to reduce the lag experienced when panning or zooming the map?

Unable to draw MKPolylineView crossing longitude +/-180

爱⌒轻易说出口 提交于 2019-12-04 04:15:41
问题 I'm having a problem drawing an MKPolylineView on an MKMapView. The line represents a trip around the world, which begins and ends near New York, always traveling east. One leg of the trip, from Japan to San Francisco, crosses the Pacific ocean, and therefore longitude +/-180. The MKPolylineView does connect those two points, but it travels in the wrong direction. That is, the line travels west from Japan back to San Francisco, instead of east across the Pacific. I don't see any option that