Search code examples
iosobjective-canimationuiviewcore-animation

UIView switching transition?


I want to make a splash screen that shows an UIImage view and a UIActivityIndictor then after the application has finished loading, it fades into a new view, I have no idea how to make one view "fade" (as in dissolve) into another view and I'm not sure how to "pause" the code until it finishes loading the background parts, any help? Thanks so much!


Solution

  • So the below code shows a splash screen for 1 second, then it animates dissolving of the screen.

    [UIView beginAnimations: @"Fade Out" context:nil];
    
    // wait for time before begin, your splash screen shows for 1 second
    [UIView setAnimationDelay:1.0];
    
    // duration of animation, the splash screen dissolved in quarter of a second.
    [UIView setAnimationDuration:0.25];
    viewToDissolve.alpha = 0.0;
    [UIView commitAnimations];
    
    //animation complete, now show the main screen. you can use uinavigationviewcontroller or other methods.