cashapelayer

UIButton with CAShapeLayer makes title disappear while scrolling

落花浮王杯 提交于 2020-01-06 16:24:14
问题 I have a ProfileCollectionViewCell with one method: func configureCellWithProfile(profile: Profile) { shapeLayer.removeFromSuperlayer() let path = CGPathCreateMutable() CGPathMoveToPoint(path, nil, 0, 0) CGPathAddLineToPoint(path, nil, CGRectGetWidth(likeButton.frame), 0) CGPathAddLineToPoint(path, nil, CGRectGetWidth(likeButton.frame), CGRectGetHeight(likeButton.frame)) CGPathCloseSubpath(path) shapeLayer.fillColor = profile.favourite ? UIColor.brilliantRose().CGColor : UIColor.blackSqueeze(

Adding CAShapeLayer as sublayer not visible

徘徊边缘 提交于 2020-01-05 08:23:09
问题 I'm having my first experience with CALayers , and am no doubt doing something very simple, very wrong. The below code is in a class extended from a UIView . I am accessing the CALayer of the view, which is fine, and the attempting to attach a sublayer, based on a line drawn by the users touch. (The CGPath ) By setting the background to bright orange, I can see that I'm passing the right CALayer into my function, yet if I try and set the CAShapeLayer *line to orange - I don't seem to be able

Adding CAShapeLayer as sublayer not visible

假装没事ソ 提交于 2020-01-05 08:22:01
问题 I'm having my first experience with CALayers , and am no doubt doing something very simple, very wrong. The below code is in a class extended from a UIView . I am accessing the CALayer of the view, which is fine, and the attempting to attach a sublayer, based on a line drawn by the users touch. (The CGPath ) By setting the background to bright orange, I can see that I'm passing the right CALayer into my function, yet if I try and set the CAShapeLayer *line to orange - I don't seem to be able

macOS High Sierra and CAShapeLayers, NSImageView, NSTableView confilcts

筅森魡賤 提交于 2020-01-03 17:06:51
问题 I have updated to macOS High Sierra and have now unexpected problems in my project, the problems not seen before in macOS Sierra. I have custom NSImageView and after drag and drop of image in this NSImageView I can draw the rectangles on top of the image using CAShapeLayers and mouseDown , mouseDragged function. Then, I can calculate intensities of the image parts inside of the rectangles. The intensities data is in array and this array is used for NSTableView . NSImageView and NSTableView

Change CALayer color while animating

血红的双手。 提交于 2020-01-01 07:11:06
问题 APPROACH 1 CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeStart"]; [CATransaction begin]; { [CATransaction setAnimationDuration:15];//Dynamic Duration [CATransaction setCompletionBlock:^{ }]; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; animation.autoreverses = NO; animation.removedOnCompletion = NO; animation.fromValue = @0; animation.toValue = @1; animation.timeOffset = 0; animation.fillMode =

Detecting a tap on a CAShapeLayer in Swift?

北城以北 提交于 2019-12-31 22:38:25
问题 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 hitTest the best method, and if so how is it used in Swift especially with CAShapeLayer s? Also, if I had numerous CAShapeLayers , how would I use the hitTest method to refer to them individually? This is how I created the CAShapeLayer : let newBounds = CGRect(x: 0, y: 0, width: 200, height: 200)

iOS: CAShape Layer Path Transformation

非 Y 不嫁゛ 提交于 2019-12-30 05:25:25
问题 I have used CAShape Layer before doing basic transformation on paths - from a smaller circle into a larger circle. Good enough, but then I tried to transform a triangle into a circle; it worked, but the transformation is weird. Other words, from one shape to another, it "flips", "twists" before the final shape is formed. With the same shapes, there is no problem - from a circle to a circle - but with different shapes, the transformation is weird. I wonder if this is the expected way? Or is

iOS animate/morph shape from circle to square

♀尐吖头ヾ 提交于 2019-12-28 05:41:27
问题 I try to change a circle into a square and vice versa and I am almost there. However it doesn't animates as expected. I would like all corners of a square to be animated/morphed at the same time but what I get is the following: I use CAShapeLayer and CABasicAnimation in order to animate shape property. Here is how I create the circle path: - (UIBezierPath *)circlePathWithCenter:(CGPoint)center radius:(CGFloat)radius { UIBezierPath *circlePath = [UIBezierPath bezierPath]; [circlePath

Swift: Animate layers in sequence from UIView

和自甴很熟 提交于 2019-12-25 07:59:41
问题 I've added a few layers to an UIView and now wish to animate these in sequence. I have 5 layers to animate, these are all circles. I use observable fields to get notified of the changes in the values and start to animate using the needsDisplayForKey() and actionForKey() methods. The observable fields: @NSManaged private var _startAngle: CGFloat @NSManaged private var _endAngle: CGFloat Currently all the layers animate at the same time when I change one of the observable fields for each layer.

How to get CAShapeLayer to work with constraints with swift?

对着背影说爱祢 提交于 2019-12-25 06:14:36
问题 i got this in viewdidload rectShape1 = CAShapeLayer() rectShape1.fillColor = UIColor.blueColor().CGColor rectShape1.path = UIBezierPath(roundedRect: rectShape1.bounds, byRoundingCorners: .BottomLeft | .TopRight, cornerRadii: CGSize(width: 20, height: 20)).CGPath redview.layer.addSublayer(rectShape1) var constTop = NSLayoutConstraint(item: redview, attribute: NSLayoutAttribute.CenterX, relatedBy: NSLayoutRelation.Equal, toItem: view, attribute: NSLayoutAttribute.CenterX, multiplier: 1,