Questions tagged [cashapelayer]

CAShapeLayer is a special purpose CALayer subclass for drawing animatable shapes using cubic Bezier splines. It's a part of the QuartzCore framework and is available for both iOS (since iOS 3.0) and OS X (since OS X v10.6 "Snow Leopard").

CAShapeLayer is a special purpose CALayer subclass for drawing animatable shapes using cubic Bezier splines. It's a part of the framework and is available for both (since iOS 3.0) and (since OS X v10.6 "Snow Leopard").

The shapes is defined using the path property and can be both filled and stroked using the fillColor and strokeColor properties. Note that the backgroundColor property inherited from CALayer does not fill the shape. The path of the shape is animatable (but doesn't support implicit animations) but the appearance of the animation is undefined if the two paths have a different number of control points or segments.

There are several properties (animatable) to configure how the shape is stroked and filled. Using these properties the stroke can for example get a moving dashed patten (commonly called "marching ants").

The strokeStart and strokeEnd properties can also be used to only stroke part of the shape or to animate the shape being stroked. Both values go from 0.0 (beginning of path) to 1.0 (end of path) and values in between are interpolated along the path.


The page about Paths in the Quartz 2D Programming Guide is a great resource for learning more about creating paths, stroking, rounding and joining paths, filling paths and creating dash patterns.

951 questions
-1
votes
1 answer

unable to create exact path

I want to create image view like this. With Bezier path, the code i tried is let path = UIBezierPath() path.move(to: CGPoint(x: myImage.frame.size.width - 10 , y: myImage.frame.size.height)) path.addLine(to: CGPoint(x:…
-1
votes
2 answers

IOS: Cannot Change Color of CAShapeLayer

I want to create a layer to act as a mask for my UIImageView which was created in interface builder. However, no matter what I do the layer remains white. The code is pretty straightforward any ideas what is causing this behavior ? UIImage* image =…
Joel Parker
  • 295
  • 1
  • 4
  • 17
-1
votes
1 answer

Take UIImage of UIViews layer property

I am Adding multiple CAShapeLayers to layer property of my UIView subclass by calling [self.layer addSublayer:shapeLayer]; To capture these layers in a UIImage I have implemented the following method which is meant to take an image of the layer…
regetskcob
  • 1,172
  • 1
  • 13
  • 35
-1
votes
1 answer

Can I use more slicing lines with UIImage?

I want to change rectangle proportions dynamically but preserving semicircle's proportions. Semicircle should be aligned to the bottom and centered horizontally: How can I add more slicing lines to UIImage in Xcode? I have made what I want in Nine…
Igor Kasuan
  • 792
  • 2
  • 10
  • 25
-1
votes
1 answer

How to implement drawing tool in iOS?

I'm trying to implement a freehand drawing tool by which user can draw several shapes dynamically like rectangle,eclipse,circle etc on a PDF using touch begins and touch move methods. So anyone there who have done this kind of tool or have…
Amir Khan
  • 1,318
  • 1
  • 14
  • 39
-1
votes
1 answer

Making a UIButton with shape CAShapeLayer

So I'm making a kind of simple game based on hexagons. Here's what it looks like: I've managed to draw the hexagons exactly the way I want them as CAShapeLayers, but I'd like to make them clickable. In short I would like to cast them somehow into…
user786033
-1
votes
1 answer

How to Remove CAShapelayer along user touch?

This is my coding to draw a line using CAShapeLayer .no i like to remove the CAShapeLayer along user drag. UIBezierPath *path = [UIBezierPath bezierPath]; [path moveToPoint:CGPointMake(touchPoint.x,touchPoint.y)]; …
Kishore kumar
  • 143
  • 1
  • 14
-1
votes
5 answers

Round out the top right and left corners of a view?

I'm trying to figure out how to mask a UIView to display a shape that represents a Square with half of a circle sitting ontop of it. Basically, it would be like applying a border radius to only the top two corners to round them out and create an…
Hobbyist
  • 15,888
  • 9
  • 46
  • 98
-1
votes
1 answer

How to detect taps on CAShapeLayer?

Well I have made a UIView subclass. Inside it a have placed a UIScrollView object that has a circular shape and contains a uiviewimage. I have also placed CAShapeLayer that has a circular shape. the CAShapeLayer is above the UIScrollView and is…
-1
votes
1 answer

Is using CAShapeLayer backed UIView's a better approach than using plain CAShapeLayer?

I am working on a prototype for building a DFD builder. This will have a palette of different objects for drawing DFD. (Rectangle boxes, arrows, Ellipses,circles). I initially planned to use plain CAShapeLayer's to create objects and add it to the…
RK-
  • 12,099
  • 23
  • 89
  • 155
-1
votes
1 answer

How to make special gray overlay in objective c

If you should do something like this overlay in Objective C how would you approach it? http://screencast.com/t/Hgif0AtCFl It must follow the current time of the day so I don't think an image will work - any ideas?
Morten Holmgaard
  • 7,484
  • 8
  • 63
  • 85
-2
votes
1 answer

Animate a CALayer frame change

I'm trying to create a Custom Progress Bar View and the idea is to have a timer that will update every second. However, the transition from the progress is not so smooth. If I reduce the timer interval to something like 0.01 instead of 0.1 the…
chr0x
  • 1,151
  • 3
  • 15
  • 25
-2
votes
2 answers
-2
votes
1 answer

How to add gradient in UIBezierPath iOS

How to add a gradient in UIBezierPath, I have a draw path in my UITabbar but I am not able to add a gradient in draw path, I don't want to apply as UITababr background, I want to apply only in draw path. below is my code private func addShape() { …
Darshan
  • 2,272
  • 3
  • 31
  • 43
-2
votes
1 answer

animate fill color of a curve made with a bezier?

I am able to animate the stroke of a curve on time series, but this curve is filled with a color, and the color won't animate, i will see the stroke moving and the fill color is already there. let shapeLayer = CAShapeLayer() shapeLayer.fillColor = …
Curnelious
  • 1
  • 16
  • 76
  • 150
1 2 3
63
64