2
votes

I have a splash screen in my application. But the splash screen appears only when application is run from xcode and does not appear when launched directly from the simulator.

Please help me.

Thanks.

3
How do you implement splash screen ? Need more information. - raaz
gigaom.com/apple/iphone-dev-sessions-making-a-splash-screen this is the correct way for splash screen with your own duration - Marios

3 Answers

2
votes

in app delegate.h class

UIImageView *myImgView;
 //---------methods to show and hide splash----------
 -(void)ShowSplash;
 -(void)hideSplash;

in app delegate .m class

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
// Override point for customization after application launch.
   self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
[self ShowSplash];
[self.window makeKeyAndVisible];
return YES;
 }
 -(void)ShowSplash
 {
myImgView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
myImgView.backgroundColor=[UIColor colorWithRed:0 green:.3 blue:0.5 alpha:1];
myImgView.image=[UIImage imageNamed:@"splashscreen.png"];
[self.window addSubview:myImgView];
[self performSelector:@selector(hideSplash) withObject:nil afterDelay:1];
 }

 -(void)hideSplash
 {  
[UIView beginAnimations:@"flipping view" context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:myImgView.superview cache:YES];
[myImgView removeFromSuperview];
[UIView commitAnimations];
[myImgView release];
myImgView=nil;
self.window.rootViewController = self.viewController;

   }
1
votes

Its difficult to advice without further information, but this sounds like your app is taking longer to load when run from XCode since the debugger will be attaching at bootup etc, whereas launching from the simulator itself will be a quicker boot - perhaps the splash screen isn't staying on screen long enough for you to see it?

If you have implemented an additional splash screen to the standard boot screens 'defaultXXX.png', could you elaborate on how you have coded it?

1
votes

Which SDK are you using? If you use 4, probably your issue is connected with multitasking. In simulator with iOS4 when you launch your app you actually restore your app not lauch, if app was previously opened. When you start your application from XCode it "copies" your app to the simulator and starts "new instance".