简体   繁体   中英

How to draw custom line on MKMapview?

I've been searching for a way to draw a custom line, but the only help I can find is how to draw lines with an UIColor.

I want to draw a straight line but not just with a color. I want the appearance of the line to be customizable.

(So right now I can draw lines between 2 points, but not the line I want)

The line I want got straight 45 degree lines on it, and it's grey and black.

Anybody can help?

The line looks like this, I'm also thinking that I could stretch this image, but if I stretch it, it will look kinda weird.

在此处输入图片说明

Why don't you add image then? I'm new developer so I don't know other way to do it. Only OpenGL with texturing, but there is no need to use openGL. So my suggestion is to add image.

Sound like what your looking for is the MKPolylineView Class . You assign it a polyline which contains the points in your line. Since the polyline view is an MKOverlayPathView you can set the stroke and fill colors.

Since it's also a UIView subclass you can manipulate the appearance even further by grabing the views layer property and adding gradients, shadows, masks, etc.

Is there a specific effect that you're trying to achieve?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM