Search code examples
iosswiftxcodeanimationuiimageview

Animating launch screen zoom


1:

I'm trying to animate a zoom out/size change of a UIImageView . Below is how I want the launch screen to look and then once it's loaded to go onto my HomeViewController.

How I want it to look

2:

Because (at the moment) I'm doing the animation on the HomeViewController which I know isn't the right way to do it, the buttons on my VC instantly appear as the animation is happening

Button problem

3:

And finally, this is almost how I want it to look, but to achieve this, I've put a UIView which covers the buttons but not the logo and have animated it to fade as if the buttons were fading in.

With UIView

So how would I do the initial animation on the launch screen before loading my HomeViewController? I can't seem to add my UIImageView onto my AppDelegate.swift to do the animation there, many thanks!

CODE: (in viewDidLoad of HomeViewController)

let orginalY = self.imageView.center.y
    UIView.animate(withDuration: 1.0, animations: {() -> Void in
        self.imageView?.transform = CGAffineTransform(scaleX: 0.5, y: 0.5)
        self.imageView.center.y = orginalY - 100
    }, completion: nil)

    UIView.animate(withDuration: 1.2) {
        self.hidingView.alpha = 0
    }

Solution

  • You can't do custom animation on launchscreen storyboard. You will have to use a SplashViewController before showing the HomeViewController and in your completion block of the animation present the HomeViewController in full screen.