tags:

views:

137

answers:

1

A Default.png in your application directory looks like a good way to get a zoom-in splash screen "for free". Zero LOC and everything happens before your applicationDidFinishLaunching gets called so your app launch feels snappy.

Unfortunately it erases itself a bit earlier than I would like: sometime after applicationDidFinishLaunching, but before I start drawing.

Does anyone know when it happens and I how can convince it to stay longer?

A: 

How do you start drawing? I think it goes away the first time the screen is drawn, which seems to be at the end of the first run loop.

You can create the effect of having it stay longer by showing an image view of Default.png. Something like (untested):

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 480.0)];
imageView.image = [UIImage imageNamed:@"Default.png"];
imageView.tag = 1234; // Must be a unique tag (int)
[window addSubview:imageView];
[imageView release];
//...
// When you want to hide/remove it:
UIView *defaultPng = [window viewWithTag:1234];
[defaultPng removeFromSuperview];

If you want it to be shown for some specific period of time, I imagine you'd use the second part of the code either in an NSTimer action method, or a method called using performSelector:withObject:afterDelay:. If the delay is unknown, you can use that code wherever you like.

Caveat: If your app is multithreaded, make sure it's called from the main thread. You can use performSelectorOnMainThread:withObject:waitUntilDone:.

Hope this helps.

Elliot