1

My client wants his splash image to fade out and then show the UI. I am not sure how to do this. As of right now it just appears once it loads. Is there a simple way to do this ?

Mazyod
  • 22,319
  • 10
  • 92
  • 157
Gabriel
  • 328
  • 5
  • 16

4 Answers4

3
UIImageView *splash=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"splash"]];
[UIView animateWithDuration:1
                 animations:^{
                     splash.alpha = 0.0;
                 }
                 completion:^(BOOL finished)
 {
     [splash release];
 }]; 
mhunturk
  • 296
  • 2
  • 12
1

I was looking at this tutorial but decided not to implement it so I cant vouch as to whether it works or not but everything looks in check

http://www.dobervich.com/2010/10/22/fade-out-default-ipad-app-image-with-proper-orientation/

Beware though adding to much to your app startup is grounds for app rejection.

Avoid displaying an About window or a splash screen. In general, try to avoid providing any type of startup experience that prevents people from using your application immediately.

Source: Apple Developer Site

atrljoe
  • 8,031
  • 11
  • 67
  • 110
1

As I just explained on a closely related question, don't use splash screens! Please relate this to your client, who might not be familiar with the Human Interface Guidelines.

That said, if you can't convince you client otherwise, you can just fade out the UIImageView that I mentioned in my other response.

Community
  • 1
  • 1
Conrad Shultz
  • 8,748
  • 2
  • 31
  • 33
1

You can implement your own UIViewController as a splash screen:

@interface SplashScreenViewController : UIViewController {
    UIImageView *splashView;
}

@end

//

#import "SplashScreenViewController.h"

@implementation SplashScreenViewController

#pragma mark - View lifecycle

- (void)loadView {
    self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];

    splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [splashView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
    [self.view addSubview:splashView];
}
- (void)viewWillAppear:(BOOL)animated {
    if (isIPad) {
        if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
            splashView.image = [UIImage imageNamed:@"Default-Portrait~ipad.png"];
        else
            splashView.image = [UIImage imageNamed:@"Default-Landscape~ipad.png"];
    }
    else
        splashView.image = [UIImage imageNamed:@"Default.png"];
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
    if (isIPad) {
        if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation))
            splashView.image = [UIImage imageNamed:@"Default-Portrait~ipad.png"];
        else
            splashView.image = [UIImage imageNamed:@"Default-Landscape~ipad.png"];
    }
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (isIPad ? YES : UIInterfaceOrientationIsPortrait(interfaceOrientation));
}

@end

Then, after showing, you can hide this UIViewController with any transition you want.

demon9733
  • 1,054
  • 3
  • 13
  • 35