iosobjective-canimationlaunching

Animation in viewDidLoad is glitching out


I'm working on a loading animation for an app and I put the animation code within a button press for debugging purposing and such. I tried it in the viewdidload method and it doesn't do even close to the same animation as when it is in the button press method. Is there something I can do to fix this so that I will be able to use it as a loading animation that won't glitch out? Thanks for the help.


Solution

  • Often it's best to defer this sort of animation to viewDidAppear, as viewDidLoad is called before the view is fully configured and you can have strange results (e.g. the frame of the view will be CGRectZero, even though the bounds may be fine).

    If that doesn't do it, please share your animation code with us and we might be able to offer more concrete counsel.