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
-2
votes
1 answer

Load CAShapeLayer With UIButton on viewWillAppear Method

I have a custom button with some shadow effect, following class i am using to create a custom button which i got from stackoverflow. It users CAShapeLayer to give effect of shadow on button. import UIKit class CustomButton: UIButton { var…
Deepak
  • 1,030
  • 2
  • 10
  • 21
-2
votes
2 answers

UIBezierPath Rounded corners

I am trying to make this image appear with some rounded corners, dictated in code below My code for this is as follows. I want path1,path[4], path[5] rounded. I am open to a different approach. Please dont recommend UIBezierPath(roundedRect:..) as I…
MattEm
  • 181
  • 1
  • 8
-2
votes
1 answer

Restricting pan gesture to move to 90 degree

If I have created a line for ex. shown in the figure as connecting A and B through CAShapeLayer and in that line's centre I have a UIView which has pan gesture integrated in it. How to make that UIView to move to a certain direction that creates 90…
Bhargav Kukadiya
  • 418
  • 7
  • 17
-2
votes
1 answer

CAShapeLayer for draw triangle with rectangle

I want to draw triangle with rectangle like this image. But I can draw like this shape using this code. CAShapeLayer *mask = [[CAShapeLayer alloc] init]; mask.frame = imgTest.layer.bounds; CGFloat width = imgTest.layer.frame.size.width; CGFloat…
hmlasnk
  • 1,160
  • 1
  • 14
  • 33
-2
votes
3 answers

How to use "DEGREE" in my iOS application

Hi I need to make a 2D arch. Where I am getting a problem here arc.path=[UIBezierPath bezierPathWithArcCenter:CGPointMake(50, 100) radius:80.0 …
user1931542
  • 29
  • 1
  • 3
-3
votes
1 answer

How can you create this shape in Swift?

I tried to create this very unique shape in swift a long time ago but failed. My goal is to draw a shape like in this image here (I mean the darker shape in that image). How can you create such a unique shape in Swift?
Oscar Junius
  • 320
  • 3
  • 10
1 2 3
63
64