EDIT 1: changed the code to:
delegate.h:
#import <UIKit/UIKit.h>
@class ViewController;
@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
ViewController *viewController;
UIImageView *splashView;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet ViewController *viewController;
@property (nonatomic, retain) IBOutlet UIImageView *splashView;
- (void)removeSplash;
@end
delegate.m:
#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
@synthesize window;
@synthesize viewController;
@synthesize splashView;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
splashView.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Splash" ofType:@"png"]];
[window addSubview:splashView];
[window bringSubviewToFront:splashView];
[window makeKeyAndVisible];
[self performSelector:@selector(removeSplash) withObject:nil afterDelay:5.0];
[window addSubview:viewController.view];
return YES;
}
- (void)removeSplash {
[splashView removeFromSuperview];
[splashView release];
}
- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}
@end
EDIT 2:
when i use:
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
splashView.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Splash" ofType:@"png"]];
if (splashView.image == nil) {
NSLog(@"splashView is nil");
}
it logs "splashView is nil"
My Viewcontroller is empty, just for debugging purposes. Thnx in advance!