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.
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.
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;
}
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?
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".