How to create an animated Intro View in iOS

No comments on How to create an animated Intro View in iOS

Written by

in

I will explain, how to create an animation, when you Default image comes to front with dissolving.

To create an animated Intro View in iOS App, which has a TabBarController you may do the following:

    1. Create an Intro View Controller, which has one UIImageView with your Default.png.
    2. Add the following to your application didFinishLaunchingWithOptions method
      IntroViewController *introViewController = \
      [[IntroViewController alloc] initWithNibName: \
      @"IntroViewController" bundle:nil];
          self.window.rootViewController = introViewController;
          
          [self.window makeKeyAndVisible];
      
    3. Add the following method to your IntroViewController:
      - (void)viewDidAppear:(BOOL)animated
      {
          [super viewDidAppear:animated];
          
          [UIView animateWithDuration:0.5
                           animations:^{
                               CGRect frame = self.imageView.frame;
                               frame.origin.x -= frame.size.width;
                               frame.origin.y -= frame.size.height;
                               frame.size.width *= 3;
                               frame.size.height *= 3;
                               self.imageView.frame = frame;
                               self.imageView.alpha = 0.0;
                           }
                           completion:^(BOOL finished){
                               useDelegate
                               appDelegate.window.rootViewController = \
      appDelegate.tabBarController;
                           }
          ];
      }
      

    Explanation:
    After app loads, Intro View Controller is diplayed. Then, when it’s view appears, it’s UIImageView’s frame is trippled in size and it’s origin is moved to top left. Also the transparency is changed to 100%. After animation finishes, your tab bar controller is displayed.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *