TsGDev
TsGDev

Reputation: 97

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
    }

Upvotes: 0

Views: 1400

Answers (2)

ibnetariq
ibnetariq

Reputation: 738

You cannot animate your LaunchScreen. Most of the apps in which you see animation actually have an intermediate controller/screen. Flow would be some thing like this.

  1. Launch Screen (You can't do any thing here. OS will setup your application)
  2. AnimationViewController (This is where you will do some of you initial setup and also animation)
  3. HomeViewController (Rest of the flow for your application).

Upvotes: 1

Frankenstein
Frankenstein

Reputation: 16341

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.

Upvotes: 1

Related Questions