core-animation

Can I increase the animation speed of presentModalViewController?

蓝咒 提交于 2019-12-21 17:44:14
问题 I'm writing a drawing application that shows a tools view controller when the user clicks an item in a toolbar. However, several of my beta testers have reported that the tools palate opens too slowly. I'm using the standard presentModalViewController:animated: call to display the tools, and I've tried wrapping it in a code block like this to speed it up: [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration: 0.1]; [self presentModalViewController:settings animated:YES];

Rotating a CAShapeLayer arc about its center using CABasicAnimation

与世无争的帅哥 提交于 2019-12-21 16:54:41
问题 I have an arc that I have drawn using CAShapeLayer and I want it to rotate around the circle's center. I am trying to get this animation using a CABasicAnimation on the 'transform.rotation' property. But the rotation seems is happening about a point that is not the same as the circle's center. -(void)drawRect:(CGRect)rect{ int radius = 100; CAShapeLayer *circle = [CAShapeLayer layer]; circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0*radius, 2.0*radius) cornerRadius

Move CALayer via UIBezierPath

99封情书 提交于 2019-12-21 13:58:11
问题 I have a layer that will move from point A to point B on a UIBezierPath. I have found a lot of samples those are refers to CAAnimation and UIBezierPath. But I need to move my layer only from specified point to another on bezier path. Any suggestions would be appreciated. Thanks 回答1: Hope this will be helpful. UIBezierPath *trackPath = [UIBezierPath bezierPath]; . . . CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position"]; anim.path = trackPath.CGPath; anim

Move CALayer via UIBezierPath

那年仲夏 提交于 2019-12-21 13:58:11
问题 I have a layer that will move from point A to point B on a UIBezierPath. I have found a lot of samples those are refers to CAAnimation and UIBezierPath. But I need to move my layer only from specified point to another on bezier path. Any suggestions would be appreciated. Thanks 回答1: Hope this will be helpful. UIBezierPath *trackPath = [UIBezierPath bezierPath]; . . . CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position"]; anim.path = trackPath.CGPath; anim

How to Anti-Alias Layers in iPhoneOS

和自甴很熟 提交于 2019-12-21 12:40:57
问题 We've had Reiner Knizia's Money out for a couple of months now. It's done pretty well, and so we've been updating it as time allows. However, one thing continues to bug me. I've never been able to get my layered cards to anti-alias correctly. Here's a sample: Cards that are laid straight are very clean, but whenever they're angled the black lines around the cards get jagged. I've tried this depending on both lines implicit to the artwork and lines drawn through drawRect:, and they both do the

CABasicAnimation not changing its position property after animation completes

依然范特西╮ 提交于 2019-12-21 12:31:31
问题 i am applying CABasicAnimation for position property of a layer it is animating well but after animation complete its coming back to original position how to avoid that and to make image to stay in animated position only? 回答1: There are a few different ways to solve this. My favorite is to set the object at the end of the animation, and use fromValue instead of toValue to create the animation. You can also set both fromValue and toValue to create this effect. ie CABasicAnimation *animation =

Calling setNeedsDisplay:YES on layer-hosting view does not redraw the view

喜你入骨 提交于 2019-12-21 09:59:08
问题 I have a layer-hosting view set up like this in a custom NSView subclass: [self setLayer:rootLayer]; [self setWantsLayer:YES]; I add all the sublayers to the layer tree after I called setNeedsDisplay on each sublayer. Each layer's content is provided by a drawLayer:inContext method of my layer's delegate. Here is my problem: After initializing my view the view gets draw correctly. However, when the model has changed and I call [myCustomView setNeedsDisplay:YES]; from my view controller the

CALayer delegate method drawLayer not getting called

旧城冷巷雨未停 提交于 2019-12-21 07:23:10
问题 My object a sub class of NSObject has CALayer instance variable. I use it for drawing and caching content with its delegate set to my object. But for some reason drawLayer:inContext: method NEVER gets called. Whereas actionForLayer:forKey: delegate method does get called implying the delegate is getting set properly with layer.delegate = self in the object's init method. Any suggestions on what is preventing my layer drawing method drawLayer:inContext: from getting called ? I am called the

Why does a CAShapeLayer's stroke extend out of the frame?

瘦欲@ 提交于 2019-12-21 07:06:08
问题 Here's sample code: //Called by VC: HICircleView *circleView = [[HICircleView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; // init of circle view - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { CAShapeLayer *borderLayer = [CAShapeLayer layer]; borderLayer.fillColor = [UIColor whiteColor].CGColor; borderLayer.path = [UIBezierPath bezierPathWithOvalInRect:self.frame].CGPath; borderLayer.strokeColor = [[UIColor redColor] CGColor]; borderLayer.lineWidth =

CAGradientLayer showing as solid color

江枫思渺然 提交于 2019-12-21 06:17:46
问题 I'm trying to set a gradient background on a view, but my code below makes the UIView appear solid black. If i change the whiteColor to greenColor, the gradient is displayed properly. Changing the backgroundColor of the layer to greenColor makes the view appear solid green. My guess is that i'm dealing with some kind of transparency-issue, but i can't figure to work around it. CAGradientLayer *gradientLayer = [CAGradientLayer layer]; gradientLayer.colors = [NSArray arrayWithObjects: (id)[