cashapelayer Questions

2

Solved

I am currently converting an MKPolyline to a BezierPath then a CAShapeLayer then adding the layer as a sublayer to a UIView. Currently struggling to ensure the path is not drawn outside the bounds ...
Felishafelita asked 7/2, 2017 at 9:13

4

I want to draw a circle with color gradient stroke like the following picture, on both iOS and macOS: Is it possible to implement with CAShapeLayer or NSBezierPath/CGPath? Or any other ways?
Ocular asked 22/10, 2016 at 3:36

1

Solved

I have a CAShapeLayer() with a gradient on top which is being animated, but somehow it looks like in the image below: How come it looks like this? My code: override func viewDidLayoutSubviews()...
Simonsimona asked 29/5, 2019 at 16:28

2

Solved

I'm trying to darken the surrounding area of my UIImageView, and leave a portion alone (which I define with my mask). Right now I'm defining my mask and setting my imageView.layer.mask, however in...
Measure asked 4/4, 2013 at 4:50

2

Solved

I'm making a custom view that i want to mask and to add shadow to it. the masking: let p = UIBezierPath() p.moveToPoint(CGPointMake(20, 20)) p.addLineToPoint(CGPointMake(100, 20)) p.addLineTo...
Imbecility asked 1/6, 2016 at 11:43

3

Solved

I'd like to create a dash border around a view, which can be moved/rotated/scaled. Here's my code: func addBorder() { let f = selectedObject.bounds.applying(selectedObject.transform) borderVi...
Metencephalon asked 1/10, 2018 at 10:58

3

Solved

In portrait mode (first time drawing) After rotating to landscape, why are the older shapes: I am using UIBezierPath & CAShapeLayer to draw circles & lines in a custom UIView's layer....
Radiotelephony asked 3/12, 2014 at 15:49

1

Solved

I drew a simple circular progress view like this: let trackLayer:CAShapeLayer = CAShapeLayer() let circularPath:UIBezierPath = UIBezierPath(arcCenter: CGPoint(x: progressView.frame.width / 2, y: 3...
Bristletail asked 19/7, 2018 at 18:21

3

Does anyone have any experience in applying a Gradient to a CAShapeLayer? CAShapeLayer is a fantastic layer class, but it appears to only support solid fill coloring, whereas I'd like it to have a ...
Glimmering asked 19/1, 2011 at 10:8

2

Solved

This is my code: @objc func drawForm() { i = Int(arc4random_uniform(UInt32(formNames.count))) var drawPath = actualFormNamesFromFormClass[i] shapeLayer.fillColor = UIColor.clear.cgColor shapeL...
Shellacking asked 27/3, 2018 at 17:22

2

Solved

I am using a UIBezierPath to draw a curved line. The curve works however, I am unable to curve the edges of the line. If you look at the top/bottom end of the curve, you can see that the edges are...

4

Solved

I'm quite new to iOS Development (so please forgive my ineptitude - I've looked everywhere!), and was looking to find a way to detect a tap on a CAShapeLayer. So far, I've come across hitTest. Is h...
Meridel asked 21/4, 2015 at 13:9

1

Solved

I'm trying to make a custom shape UIButton using mask layers and I was successful extension UIButton { func mask(withImage image : UIImage , frame : CGRect ){ let maskingLayer = CAShapeLayer...
Robey asked 24/12, 2017 at 10:45

1

Solved

I want to add an inner border to a view with a gradient. The following code works and gives me this result import UIKit class InnerGradientBorderView: UIView { override init(frame: CGRect) { ...
Stateless asked 20/12, 2017 at 2:9

1

Solved

I'd like to animate a circle from angle 0 to 360 degrees in 15 sec. The animation is weird. I know this is probably a start/end angle issue, I already faced that kind of problem with circle anima...
Lignify asked 25/7, 2017 at 15:39

5

Solved

I am attempting to draw a stroked circle by using a CAShapeLayer and setting a circular path on it. However, this method is consistently less accurate when rendered to the screen than using borderR...
Pearsall asked 19/6, 2014 at 21:43

1

Solved

The Problem I am creating an exploding rings effect. I'm using multiple CAShapeLayer's and creating a UIBezierPath for each layer. When the view is initialised, all the layers have a path with widt...
Swaddle asked 18/8, 2016 at 11:56

2

I am making an image editor which can create different shapes objects like circle, triangle and square which can also be updated or removed. So I have used CAShapeLayer for creating shapes objects....
Unscreened asked 2/10, 2013 at 12:0

3

I am trying to stroke the paths in CAShapeLayer using dash patterns. I have created many dash patterns using lineDashPattern property. But this property doesn't give any option for type of dash str...
Rafi asked 22/11, 2014 at 11:43

4

Solved

I am drawing a circle, with an initial radius of 200 self.circle = [CAShapeLayer layer]; self.circle.fillColor = nil; self.circle.strokeColor = [UIColor blackColor].CGColor; self.circle.lineWidth ...
Gilmagilman asked 14/11, 2012 at 1:35

1

Solved

I am trying to animate the mask layer on a UIView. Basically this code displays the image below: let bounds: CGRect = self.manualWBMaskView!.bounds let maskLayer: CAShapeLayer = CAShapeLayer() m...
Galatia asked 6/4, 2016 at 18:32

3

Solved

I’ve created a UIView with a semi-transparent black background to sit across my main app’s view. What I’m aiming for here is to create a cut-out circle shape somewhere in that UIView where the semi...
Antilles asked 20/1, 2014 at 11:21

2

I wanted to display a triangle shaped view in a UITableView cell like this. I managed to accomplish this using the blow code. import UIKit class TriangleView: UIView { override func drawRect...
Failsafe asked 6/4, 2015 at 17:49

4

Solved

I have a CAShapeLayer (which is the layer of a UIView subclass) whose path should update whenever the view's bounds size changes. For this, I have overridden the layer's setBounds: method to reset ...
Sherl asked 24/7, 2014 at 14:47

2

Solved

I have this piece of code: let arcPath = UIBezierPath(ovalInRect: CGRectMake(0, 0, frame.width, frame.height)) circleLayer = CAShapeLayer() circleLayer.path = arcPath.CGPath circleLayer.fillC...
Macswan asked 30/10, 2015 at 8:1

© 2022 - 2024 — McMap. All rights reserved.