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?
Related
I am trying to make an arrow shape. I understand that it will be done with CGRect method but can you give a complete example of how it will be done in SWIFT?
This can be done programmatically by first subclassing UIButton and overriding drawRect within it to form the shape of an arrow via bezier paths. Then simply set the title of the button to be whatever you want your text to be and position it accordingly within the shape you have drawn.
The benefit of doing it this way is that you can easily change the color of, scale and dimensions of the arrow since you control how the object is actually being drawn.
A good tool for drawing complex bezier paths is paintCode. I'm using the trial version and can pretty easily make shapes like this now.
I've been looking into this for a while now, and as a beginner, I can't seem to get it done. What I want to do is take a simple gradient, and use it to stroke a CGPath. I tried using CGContextSetStokePattern with a PNG the width of the line and one pixel tall containing my desired gradient, but this tiles the pattern, whilst I'd rather have it drawn along the path like a brush. Closest thing I can think of would be the Styler from Pokémon Ranger.
Essentially, I'd like my line to start out one color in the middle and move towards another at the edges. There's probably a simple way of doing this, but I cannot for the life of me figure out how.
Much thanks to anyone who can help me. :)
There's no built-in support for stroking a path in that way.
You could try to fake it by stroking the path multiple times, with each stroke having a narrow line width than the prior stroke and a different color, and maybe different shadow settings too. Of course stroking it repeatedly will take longer than stroking it once.
I have a CPTTradingRangePlot with a CPTTradingRangePlotStyleCandleStick style.
I'm looking for a way to highlight a specific (or a few) candlesticks with a different fill color (or a glow, or something), but I can't find a way to access individual candlesticks in a similar way that a CPTBarPlot has with -(CPTFill *)barFillForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)index;
Am I missing something here?
Can I somehow maybe access a specific candlestick after the data load, and then change the fill color?
I was also thinking about adding an Annotation Layer, and maybe draw a circle around the specific candlestick(s), but I don't want to use an image, since it will get stretched and pixelated when I'll adjust it's size.
Is there any way to draw a vector-based shape as an annotation around the candlesticks?
Thanks for any help!
You can put a request for that feature on the Core Plot issue tracker. In the meantime, you can achieve the same look by using more than one plot, one for each different style.
I'm creating an iphone application. I have this UIView whose content is clipped with a path. I want to add shading and/or shadow to it. What's the best way to do this? For shadow, I tried CGContextSetShadow() but it doesn't seem to have an effect (perhaps it's drawing outside the shown region?) . How about shading? I want it to appear along the path. What's the best way to go about it? Is it to create another narrow clip strip along the original clipping path (if it's possible to have two clip path... ) Or does this need to be done in another CALayer? I am not even sure what that is yet.
You can't add shadows to layers which are clipped or masked. The way I would do this is use two CALayers, one for the clipped content and place this inside another for the shadow which isn't clipped.
I've a custom shape drawing using coregraphics and i want to add a drop shadow and a gradient to it also. I've been trying and searching a lot of informations on how to combine and do this, but i can't get it to work. I'm able to draw only one either.
Anyone doing this already or know how to do this? Thank you.
Quartz only applies shadows to fills and strokes. Drawing a gradient does not count as a fill.
Fill with a solid color (to draw the shadow), then draw the gradient in the same area.