core-animation

How to add UIView subviews in a view aligned like 3x3 table

ぃ、小莉子 提交于 2020-01-05 14:11:17
问题 I have created a main View and in that I add 9 UIMyView that I subclassed from UIView. I add instances of that UIMyViews using NSBundle to load the nib file and addSubview in the main view controller, of course all of these views are appeared in the upper left corner of the super view one hiding the other and the last one to be visible, which either I need to position them somehow using points in super view or create something like a table and add to its cells the UIMyViews?! Imagine you have

Refresh animation on UIBarButtonItem

送分小仙女□ 提交于 2020-01-05 08:15:45
问题 I am trying to make a "refresh" animation using a UIBarButtonItem, the problem is that is not only rotating but moving the image up and down a bit. -(void)startRefreshButtonRotationAnimation { CABasicAnimation* rotationAnimation; rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0]; rotationAnimation.duration = 1; rotationAnimation.cumulative = YES; rotationAnimation.repeatCount = 1000; UIView

How do I save state with CALayers?

帅比萌擦擦* 提交于 2020-01-05 04:05:29
问题 I have a simple iphone application that paints blocks using a subclass of CALayer and am trying to find the best way to save state or persist the currently created layers. I tried using Brad Larson's answer from this previous question on storing custom objects in the NSUserDefaults, which worked for persisting my subclass of CALayer, but not it's basic state like geometry and background color, so they were there but did not render on relaunch. I made my declared instance variables conform to

How do I save state with CALayers?

こ雲淡風輕ζ 提交于 2020-01-05 04:05:09
问题 I have a simple iphone application that paints blocks using a subclass of CALayer and am trying to find the best way to save state or persist the currently created layers. I tried using Brad Larson's answer from this previous question on storing custom objects in the NSUserDefaults, which worked for persisting my subclass of CALayer, but not it's basic state like geometry and background color, so they were there but did not render on relaunch. I made my declared instance variables conform to

CALayer disappears after playing a CABasicAnimation backwards

◇◆丶佛笑我妖孽 提交于 2020-01-04 02:42:35
问题 I have a CALayer and I've added a CABasicAnimation to it like this: circle = CALayer() circle.frame = CGRect(x: 0, y: 0, width: 100, height: 100) circle.backgroundColor = UIColor.green().cgColor circle.cornerRadius = 50 circle.speed = 0 view.layer.addSublayer(circle) animation = CABasicAnimation(keyPath: "position") animation.duration = 1 animation.fromValue = NSValue(cgPoint: CGPoint(x: 50, y: 50)) animation.toValue = NSValue(cgPoint: CGPoint(x: view.bounds.width / 2, y: view.bounds.height /

How to Host Apple's Pitch Shift Audio Unit plugin and the like

≡放荡痞女 提交于 2020-01-03 17:22:53
问题 How do you host the PitchShift Audio Unit plugin correctly in its own window? I am developing a Mac app that hosts Apple's system supplied Audio Unit plugins. With the new OSX 10.7 Lion, some of the plugins have updated views. PitchShift is one of these. PitchShift and a few others have new knobs to change there parameters. When a knob is being turned with the mouse, a horizontal bar showing the knob's parameter value is displayed below the knob. This bar stays on screen after the knob is

How to reuse an CABasicAnimation when not removed after completion?

主宰稳场 提交于 2020-01-03 09:02:33
问题 Lots of people are talking about keeping an CABasicAnimation object around after it has been used. So by setting removedOnCompletion = NO the animation object keeps attached to the layer when the animation is complete. How would I re-launch this animation again without creating a new CABasicAnimation? What's the point of keeping this object around? The only benefit I know is that we can set removedOnCompletion = NO and set kCAFillModeForwards so that Core Animation does not revert the visual

How to reuse an CABasicAnimation when not removed after completion?

走远了吗. 提交于 2020-01-03 09:02:22
问题 Lots of people are talking about keeping an CABasicAnimation object around after it has been used. So by setting removedOnCompletion = NO the animation object keeps attached to the layer when the animation is complete. How would I re-launch this animation again without creating a new CABasicAnimation? What's the point of keeping this object around? The only benefit I know is that we can set removedOnCompletion = NO and set kCAFillModeForwards so that Core Animation does not revert the visual

How do I set the contents of a CALayer to a CGImageRef?

大兔子大兔子 提交于 2020-01-03 08:29:29
问题 I want to set the contents of a CALayer to an image. The CALayer has a contents property The documentation on that property says that "a layer can set this property to a CGImageRef to display the image as its contents." But the property takes an id so in Xcode I get the following issue: Semantic Issue: Incompatible pointer types assigning to 'id' from 'CGImageRef' (aka 'struct CGImage *') How can I assign a CGImageRef to the contents property when it only takes an id ? What am I missing here?

Is it possible to get a CATransition animation as UIImage?

喜欢而已 提交于 2020-01-03 05:54:11
问题 is it possible, to get a CATransition animation as UIImage? I make a example: CATransition *animation = [CATransition animation]; [animation setDelegate:self]; [animation setDuration:0.35]; [animation setTimingFunction:UIViewAnimationCurveEaseInOut]; animation.type = @"pageCurl"; animation.fillMode = kCAFillModeForwards; animation.endProgress = 0.65; [animation setRemovedOnCompletion:NO]; [self.view.layer addAnimation:animation forKey:@"pageCurlAnimation"]; That is the animation, Im using. It