An easy way to draw a circle using CAShapeLayer

An easy way to draw a circle is to create a CAShapeLayer and add a UIBezierPath. objective-c CAShapeLayer *circleLayer = [CAShapeLayer layer]; [circleLayer setPath:[[UIBezierPath bezierPathWithOvalInRect:CGRectMake(50, 50, 100, 100)] CGPath]]; swift let circleLayer = CAShapeLayer(); circleLayer.path = UIBezierPath(ovalIn: CGRect(x: 50, y: 50, width: 100, height: 100)).cgPath; After creating the CAShapeLayer we set its path to be … Read more

Applying a Gradient to CAShapeLayer

You could use the path of your shape to create a masking layer and apply that on the gradient layer, like this: UIView *v = [[UIView alloc] initWithFrame:self.window.frame]; CAShapeLayer *gradientMask = [CAShapeLayer layer]; gradientMask.fillColor = [[UIColor clearColor] CGColor]; gradientMask.strokeColor = [[UIColor blackColor] CGColor]; gradientMask.lineWidth = 4; gradientMask.frame = CGRectMake(0, 0, v.bounds.size.width, v.bounds.size.height); CGMutablePathRef t = … Read more

How to draw a smooth circle with CAShapeLayer and UIBezierPath?

Who knew there are so many ways to draw a circle? TL;DR: If you want to use CAShapeLayer and still get smooth circles, you’ll need to use shouldRasterize and rasterizationScale carefully. Original Here’s your original CAShapeLayer and a diff from the drawRect version. I made a screenshot off my iPad Mini with Retina Display, then … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)