core-animation

Multiple UIView Animations

让人想犯罪 __ 提交于 2019-12-12 09:27:01
问题 I am trying to perform multiple UIView animations one after the other. However, I've heard that it's bad practice to perform multiple UIView animations one after the other, and that I should instead use Core Animation. I tried this code: //First Animation [UIView beginAnimations:@"animation1" context:nil]; [UIView setAnimationDuration:2]; nwView.backgroundColor = [UIColor redColor]; nwView.frame = CGRectMake(CGRectGetMidX(screenSize), CGRectGetMinY(screenSize), width, height); nwView

Reference Counting of self in Blocks

百般思念 提交于 2019-12-12 08:58:11
问题 I'm trying to get my head around how object lifetime and reference counting interact with code blocks. In the following code I'm just doing a simple animation that flashes as the top view on a UINavigationController's stack is swapped. The tricky part is that the popped view controller is the one where this code is defined . [UIView animateWithDuration:0.2 animations:^{self.navigationController.view.alpha = 0.0;} completion:^(BOOL finished){ UINavigationController *navController = self

Subviews layer transform and layoutSubviews

被刻印的时光 ゝ 提交于 2019-12-12 08:57:25
问题 my question is related to UIView/CALayer: Transform triggers layoutSubviews in superview Where is reported that, from a TSI reply from apple: Generally, changing a geometric property of a view (or layer) will trigger a cascade of layout invalidations up the view hierarchy because parent views may have Auto Layout constraints involving the modified child. Note that Auto Layout is active in some form regardless of whether you have explicitly enabled it. In my case i have a very simple view

Custom animatable property returns NSNull?

丶灬走出姿态 提交于 2019-12-12 08:53:09
问题 Only one day left on the bounty! Can you have a custom animatable property work with the UIView animateWithDuration block syntax? I've been working on creating my own implicit animation for a custom animatable property on a custom CALayer . I have set the backing layer of a custom UIView and can use a CATransaction to animate the custom property (in the custom example I am changing the color of a circle with a custom property circleColor ). I know that UIView turns off animatable properties

CAShapeLayer with border and fill color and rounding

两盒软妹~` 提交于 2019-12-12 08:28:48
问题 How do I use CAShapeLayer to draw a line that has both a border color, border width and fill color? Here's what I've tried, but it's only ever blue... self.lineShape.strokeColor = [UIColor blueColor].CGColor; self.lineShape.fillColor = [UIColor greenColor].CGColor; self.lineShape.lineWidth = 100; self.lineShape.lineCap = kCALineCapRound; self.lineShape.lineJoin = kCALineJoinRound; UIBezierPath* path = [UIBezierPath bezierPath]; [path moveToPoint:self.lineStart]; [path addLineToPoint:self

how to set animation curve when using keyframe animation in ios?

徘徊边缘 提交于 2019-12-12 08:24:44
问题 How to set animation curve when using UIView's keyframe animation : animateKeyframesWithDuration:delay:options:animations:completion: Whatever I do in the animation block seems to be linear (unless I use the UIViewKeyframeAnimationOptionCalculationModeCubic option but this isn't what I want). I'd like to have an ease out curve on the animation like the UIViewAnimationOptionCurveEaseOut option when using regular animation : animateWithDuration:delay:options:animations:completion: 回答1: If you

Soft scroll animation NSScrollView scrollToPoint:

爷,独闯天下 提交于 2019-12-12 08:23:22
问题 I want to create soft animation between transitions in simply UI: view that moved When a call scrollToPoint: for move view to point that transition doesn't animate. I'm newbe in Cocoa programming (iOS is my background). And I don't know how right use .animator or NSAnimationContext. Also I was read Core Animation guide but didn't find the solution. The source can be reach on Git Hub repository Please help !!! 回答1: scrollToPoint is not animatable. Only animatable properties like bounds and

How Do You CAKeyframeAnimation Scale?

北战南征 提交于 2019-12-12 07:09:46
问题 I want to create an animation with several key frames. I want my Layer (a button in this case) to scale up to 1.5 then down to 0.5 then up to 1.2 then down to 0.8 then 1.0. I also want to EaseIn and EaseOut of each keyframe. As you can imagine, this will create a Springy/Bounce effect on the spot. In other parts of my app I have been using CAKeyframeAnimation like this (see below code). This creates a similar springy animation but for x and y position. Can I adapt the below code to affect

Multiple CAAnimations for animationDidStop method?

自作多情 提交于 2019-12-12 07:09:43
问题 I know you have to use this method to get the delegate method for when the animation has finished: - (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag { The problem is, how would I distinguish between multiple CAAnimations like 2 or more? I googled this and I haven't found anything useful. Please share with me on how you accomplished this! Thanks! 回答1: You can set key/value objects for CAAnimation instance like this: CABasicAnimation *theAnimation = [CABasicAnimation

UIView perspective

♀尐吖头ヾ 提交于 2019-12-12 05:43:23
问题 I've got an UIView and I want to add perspective to it. Basically I got 4 other views that the user will drag in order to create the perspective. I'd like to indicate 4 points where the UIView's corners will be. I investigated it and I figured out I have to use CALayer to do that, but I'm still no clearer on how to create this kind of transform on an iPhone. Any help, pointers or example code snippets would be really appreciated! Thanks! 回答1: Start off by taking a look at the pertinent