core-animation

CoreAnimation uncommitted CATransaction warning

帅比萌擦擦* 提交于 2019-12-24 10:28:53
问题 On Mac OS 10.8 I'm getting the following warning in my app: CoreAnimation: warning, deleted thread with uncommitted CATransaction; It suggests turning on CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces, which I did. This is the top of my backtrace: 0 QuartzCore 0x00007fff88a84b95 _ZN2CA11Transaction4pushEv + 219 1 QuartzCore 0x00007fff88a8476d _ZN2CA11Transaction15ensure_implicitEv + 273 2 QuartzCore 0x00007fff88a8bb6a _ZN2CA5Layer12begin_changeEPNS_11TransactionEjRP11objc_object +

CALayer and drawRect

£可爱£侵袭症+ 提交于 2019-12-24 10:27:42
问题 I'm completely new to Core Animation, CALayer and all this stuff, so bear with me. I have a custom NSTextField using as a Label. I would want the content to animate it's position, so the whole string get's visible if it's too long for the Labels width. Now, the animation itself is working fine. I've implemented this with CABasicAnimation: - (void)awakeFromNib { CALayer *newLayer = [CALayer layer]; CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; [animation

Suitability of using Core Animation on iOS vs using Cocos2D and OpenGL ES?

做~自己de王妃 提交于 2019-12-24 07:59:28
问题 I finished a breakout game tutorial in a book, but the ball, which is a 20x20 pixel image, was skipping frames and not moving very smoothly. That is the case on the Simulator as well as on an iPhone 4S (the real thing). The code wasn't using NSTimer (which may be slower), but was using CADisplayLink and UIImageView setFrame to do the animation. Is Core Animation on iOS not very suitable for development animation type of games? Say if it is a game of Invaders (Space Invaders) Breakout (as a

Core Animation - animation doesn't work

[亡魂溺海] 提交于 2019-12-24 07:38:57
问题 I'm attempting to use this code to animate a CALayer 's background color: CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"backgroundColor"]; animation.duration = 0.3; animation.fromValue = (id)[backgroundLayer backgroundColor]; animation.toValue = (id)[[UIColor redColor] CGColor]; [backgroundLayer addAnimation:animation forKey:@"animateBackgroundColor"]; For some reason, this doesn't do anything. Simply using: [backgroundLayer setBackgroundColor:[[UIColor redColor]

Can the size of a stretchable button image be animated in Cocoa Touch?

♀尐吖头ヾ 提交于 2019-12-24 07:27:33
问题 I'm creating a UIButton with a stretchableImageWithLeftCapWidth:topCapHeight: I would like to change it's size smoothly with Core Animation like so: float shrinkFactor = 0.2; NSTimeInterval slowSpeed = 5.0; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:slowSpeed]; UIButton *thisButton = (UIButton *)[self.view viewWithTag:2]; thisButton.frame = CGRectMake(thisButton.frame.origin.x, thisButton.frame.origin.y, buttonStretchedWidth * shrinkFactor, thisButton.frame.size

iOS layer animation - explanation

情到浓时终转凉″ 提交于 2019-12-24 06:08:06
问题 let flyRight = CABasicAnimation(keyPath: "position.x") flyRight.toValue = view.bounds.size.width/2 flyRight.duration = 0.5 flyRight.fromValue = -view.bounds.size.width/2 flyRight.fillMode = kCAFillModeBoth flyRight.beginTime = CACurrentMediaTime() + 3.4 password.layer.position.x = view.bounds.size.width/2 password.layer.addAnimation(flyRight, forKey: nil) My question is: how is it possible that before I am adding the animation, I first put the layer at the end position, but when the app goes

iPhone orientation — how do I figure out which way is up?

拟墨画扇 提交于 2019-12-24 04:16:07
问题 I'm trying to draw a 2D image on the screen that is always facing "up". If the user is rotating their phone, I want to ensure my 2D object does not rotate with the device; it should always "stand vertical". I want to compensate for the user tilting left or right, but not tilting away or towards themselves. I'm using CoreMotion to get Pitch, Roll and Yaw from the device, but I don't understand how to translate the points into the direction up, especially as the user rotates the device. Ideally

PROPER way of creating Custom Segue

久未见 提交于 2019-12-24 04:15:10
问题 Now, yes, there are hundreds of questions (and answers) of how to perform custom segues. However, and I'm no exaggerating, ALL of these answers are wrong (all 50+ I've seen)! Sorry, this might sound harsh, but the truth is, NONE of the suggested answers gives the same (correct) result as Apples built in transitions do (vertical cover etc.). To be more specific, this is the result that's expected (confirmed with logs): Segue begins (adds view to hierarchy, invokes viewWillAppear on

how to implement a zoom in/out animation for UICollectionView

最后都变了- 提交于 2019-12-24 04:15:06
问题 I got a UICollectionView with several cells on the screen. I want to add one animation that can zoom out/in the cell; The logic behind is when clicking the cell, it will invoke [self.navigationController pushViewController:_chartViewController animated:NO]; I am not clear how to zoom in/out the new _chartViewController Looking for the APIs and some key takeaways for doing it. Thank in advance! 回答1: What you're looking for is called a Custom Segue Animation. In your example you click a cell

Delay after each animation iteration in Swift

狂风中的少年 提交于 2019-12-24 03:42:44
问题 I have a Core Animation whose .repeatCount is set to Float.infinity . After each iteration of the Animation, ie. after each repetition, I want to have a delay of 3 seconds. How can I achieve this? Thanks! 回答1: You can use a function like the following to do what you need. func animateInfinitelyWithDelay(delay: TimeInterval, duration: TimeInterval) { UIView.animate( withDuration: duration, delay: delay, options: UIView.AnimationOptions.curveEaseIn, animations: { () -> Void in // Your animation