Joaquin McCoy
Joaquin McCoy

Reputation: 445

How to implement a white screen after loading screen

when my application starts, I add a tabbarcontroller to my subview, after I present (with presentModalViewController) a login screen.

What I want is a white screen just after the loading screen (Default.png) that's fades out to show the login screen.

Loading screen --> White view --> Fade out --> Login Screen

How can I implement this?

Thanks.

Upvotes: 0

Views: 129

Answers (1)

Madhup Singh Yadav
Madhup Singh Yadav

Reputation: 8114

You need to add a white view on your window in the application delegate like:

[window addSubview:viewController.view];
[window addSubview:whiteView];
[window makeKeyAndVisible];

Then after the desired time remove the white view with the help of animation like:

- (void) fadeWhiteView{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    [UIView setAnimationDidStopSelector:(animationDidStop:finished:context:)];
    [whiteView setAlpha:0.0];
    [UIView commitAnimations];
}

- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context{
    [whiteView removeFromSuperview];
    [whiteView release];
}

Upvotes: 1

Related Questions