Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bobbypotluck

macrumors member
Original poster
Feb 18, 2009
70
0
i'm trying to load an initial view with an image for 5 seconds and then suspend and load a tabBarController in my AppDelegate file. At the moment i can only load one or the other.

I tried creating a method inside the initalviewcontroller to suspend the view after delay but Xcode gives me a warning that my ViewController may not respond to the method in the appDelegate file. Here's my code at the moment

App Delegate File Code

Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
	
	SplashViewController *theSplashViewController = [[SplashViewController alloc] initWithNibName:@"SplashViewController" bundle:nil];	
	// Override point for customization after application launch
	[window addSubview:[theSplashViewController view]];
        [window makeKeyAndVisible];
	[splashController showSplash];
	[window addSubview:[rootTabBarController view]];
	
	return YES;
}

And the code for the method in the viewController file

Code:
-(void)showSplash
{
    UIViewController *modalViewController = [[UIViewController alloc] init];
    modalViewController.view = splash;
    [self presentModalViewController:modalViewController animated:NO];
    [self performSelector:@selector(hideSplash) withObject:nil afterDelay:5.0];
}

//hide splash screen
- (void)hideSplash
{
    [[self modalViewController] dismissModalViewControllerAnimated:YES];
}

Is there a better or easier way to do this?
 

bobbypotluck

macrumors member
Original poster
Feb 18, 2009
70
0
i would agree, but i want a random image loaded every time from a group of images. I tried the default.png but did not like it. it loaded too fast and i want more than just that image loaded.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.