uiviewanimation

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

Repeat animation from left to right smoothly

只谈情不闲聊 提交于 2021-02-10 06:53:08
问题 I'm trying to animate 3 squares from the left to the right. The squares should reappear from the left while they are disappearing from the right. The idea is that the squares represent clouds, so the idea is clear. This is what I currently got: class ViewController: UIViewController { // contains the squares @IBOutlet weak var containerView: UIView! override func viewDidLoad() { super.viewDidLoad() } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) startAnimating(

UIView animation lags on device

北慕城南 提交于 2021-02-08 05:18:35
问题 I'm using animation in my app and get confused, because animation is lagging on device, on simulator everything seems OK. First I tried to use [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; [UIView setAnimationCurve:UIViewAnimationCurveEaseOut]; And before commit animation there were something like ~30 lines of code with "if" blocks so I thought this might cause the problem, but then I start to use [UIView animateWithDuration:0.3 delay:0.0 options:

Adding curveEaseIn to Swift Animation

跟風遠走 提交于 2021-02-08 03:41:15
问题 I have an image that rotates but it stops abruptly. I'd like to add curveEaseOut to make it stop smoother, but when I add the animations: .curveEaseOut, I get an error. func rotateRight () { let rotation = 90.0 let transform = imageGearRight.transform let rotated = transform.rotated(by: CGFloat(rotation)) UIView.animate(withDuration: 0.5, animations: .curveEaseOut) { self.imageGearRight.transform = rotated } } I keep getting an error: Type '() -> Void' has no member 'curveEaseOut' I've also

Navigation Bar Blinks When Animating for the First Time

北城余情 提交于 2021-02-07 19:58:50
问题 I have created my own tabbarcontroller of sorts, but am having an issue with animation. When I animate the views on tab click, the navigation bar turns completely black (should be red), then blinks back to red after the animation completes. My setup and code is below. (Answers in either swift or objective-c are helpful since the tranlastion is easy) Thanks in advance! red: Navigation Bar blue: Navigation Display View grey: Tab Bar burgundy: Tab Bar Display View (This is the part being

How to synchronously animate a UIView and a CALayer

怎甘沉沦 提交于 2021-02-07 04:46:30
问题 To illustrate this question, I gisted a very small Xcode project on Github (two classes, 11kb download). Have a look at the gist here or use git clone git@gist.github.com:93982af3b65d2151672e.git . Please consider the following scenario. A custom view of mine, called 'container view', contains two little squares. Illustrated in this screenshot: The blue square is a 22x22 pt UIView instance and the red square is a 22x22 pt CALayer instance. For purposes of this question I want the two squares

Why i don't see my animation when user is logged in?

ⅰ亾dé卋堺 提交于 2021-01-05 07:08:55
问题 I created a custom LaunchSreen which works well when the user is not logged in but if he is logged in we do not see the animation (the view goes right to the Home view and doesn't wait for the animation to be completed). Do you have any idea why? import SwiftUI struct LaunchScreen: View { @EnvironmentObject var session: SessionStore @State private var animationDone = false @State private var rotation = 0.0 func getUser () { session.listen() } var body: some View { Group{ if (session.session !

Why i don't see my animation when user is logged in?

房东的猫 提交于 2021-01-05 07:08:29
问题 I created a custom LaunchSreen which works well when the user is not logged in but if he is logged in we do not see the animation (the view goes right to the Home view and doesn't wait for the animation to be completed). Do you have any idea why? import SwiftUI struct LaunchScreen: View { @EnvironmentObject var session: SessionStore @State private var animationDone = false @State private var rotation = 0.0 func getUser () { session.listen() } var body: some View { Group{ if (session.session !