core-animation

iOS Spin UIImageView with deceleration motion at random position

 ̄綄美尐妖づ 提交于 2021-02-11 17:44:44
问题 I trying to create a spin wheel which rotate on tap and it rotates for certain period of time and stops at some random circular angle. import UIKit class MasterViewController: UIViewController { lazy var imageView: UIImageView = { let bounds = self.view.bounds let v = UIImageView() v.backgroundColor = .red v.frame = CGRect(x: 0, y: 0, width: bounds.width - 100, height: bounds.width - 100) v.center = self.view.center return v }() lazy var subView: UIView = { let v = UIView() v.backgroundColor

Why can't I animate a custom property on the UIView default backgorund layer?

你离开我真会死。 提交于 2021-02-11 05:53:06
问题 I want to animate the UIView default background layer. In viewDidLoad I'm adding my custom property to animate to the view with: self.layer.delegate = self; [self.layer setValue:0 forKey:@"value"]; as described here. The setter method of the value to change looks like this and updates the added custom property on the background layer: - (void)setValue:(NSInteger)value { _value = value; [self.layer setValue:[NSNumber numberWithInteger:value] forKey:@"value"]; [self setNeedsDisplay]; } And in

Why can't I animate a custom property on the UIView default backgorund layer?

别来无恙 提交于 2021-02-11 05:52:44
问题 I want to animate the UIView default background layer. In viewDidLoad I'm adding my custom property to animate to the view with: self.layer.delegate = self; [self.layer setValue:0 forKey:@"value"]; as described here. The setter method of the value to change looks like this and updates the added custom property on the background layer: - (void)setValue:(NSInteger)value { _value = value; [self.layer setValue:[NSNumber numberWithInteger:value] forKey:@"value"]; [self setNeedsDisplay]; } And in

UIView.layer.presentationLayer returns final value (rather than current value)

我们两清 提交于 2021-02-08 10:53:24
问题 Here's some relevant code inside a UIView subclass : - (void) doMyCoolAnimation { CABasicAnimation* anim = [CABasicAnimation animationWithKeyPath:@"position.x"]; anim.duration = 4; [self.layer setValue:@200 forKeyPath:anim.keyPath]; [self.layer addAnimation:anim forKey:nil]; } - (CGFloat) currentX { CALayer* presLayer = self.layer.presentationLayer; return presLayer.position.x; } When I use [self currentX] while the animation is running, I get 200 (the end value) rather than a value between 0

UIView.layer.presentationLayer returns final value (rather than current value)

≯℡__Kan透↙ 提交于 2021-02-08 10:52:46
问题 Here's some relevant code inside a UIView subclass : - (void) doMyCoolAnimation { CABasicAnimation* anim = [CABasicAnimation animationWithKeyPath:@"position.x"]; anim.duration = 4; [self.layer setValue:@200 forKeyPath:anim.keyPath]; [self.layer addAnimation:anim forKey:nil]; } - (CGFloat) currentX { CALayer* presLayer = self.layer.presentationLayer; return presLayer.position.x; } When I use [self currentX] while the animation is running, I get 200 (the end value) rather than a value between 0

How to properly morph text in iOS?

核能气质少年 提交于 2021-02-07 22:23:29
问题 I'm desperately trying to morph a smallLabel into a bigLabel . By morphing , I mean transforming the following properties from one label to match the respective properties of the other label, with a smooth animation: font size font weight frame (i.e. bounds and position) The desired effect should look similar to the animation that is applied to the navigation controller's title label when using large titles: Now I'm aware of last year's WWDC session Advanced Animations with UIKit where they

How to properly morph text in iOS?

二次信任 提交于 2021-02-07 22:17:11
问题 I'm desperately trying to morph a smallLabel into a bigLabel . By morphing , I mean transforming the following properties from one label to match the respective properties of the other label, with a smooth animation: font size font weight frame (i.e. bounds and position) The desired effect should look similar to the animation that is applied to the navigation controller's title label when using large titles: Now I'm aware of last year's WWDC session Advanced Animations with UIKit where they

How to properly morph text in iOS?

旧时模样 提交于 2021-02-07 22:15:41
问题 I'm desperately trying to morph a smallLabel into a bigLabel . By morphing , I mean transforming the following properties from one label to match the respective properties of the other label, with a smooth animation: font size font weight frame (i.e. bounds and position) The desired effect should look similar to the animation that is applied to the navigation controller's title label when using large titles: Now I'm aware of last year's WWDC session Advanced Animations with UIKit where they

How to properly morph text in iOS?

杀马特。学长 韩版系。学妹 提交于 2021-02-07 22:11:28
问题 I'm desperately trying to morph a smallLabel into a bigLabel . By morphing , I mean transforming the following properties from one label to match the respective properties of the other label, with a smooth animation: font size font weight frame (i.e. bounds and position) The desired effect should look similar to the animation that is applied to the navigation controller's title label when using large titles: Now I'm aware of last year's WWDC session Advanced Animations with UIKit where they

How to properly morph text in iOS?

半腔热情 提交于 2021-02-07 22:10:27
问题 I'm desperately trying to morph a smallLabel into a bigLabel . By morphing , I mean transforming the following properties from one label to match the respective properties of the other label, with a smooth animation: font size font weight frame (i.e. bounds and position) The desired effect should look similar to the animation that is applied to the navigation controller's title label when using large titles: Now I'm aware of last year's WWDC session Advanced Animations with UIKit where they