Opening View Crashes

ngd12

New member
Jan 26, 2010
1
0
0
Visit site
I'm a student trying to get into iPhone Development, and i'm building an app that has a view that shows for 2 seconds that just shows a logo and then I want it to load the UITabBarController that is the rest of the app. Right now i can get the OpeningView to load and have the timer count down, but once the timer is done and calls a method to load the UITabBarController's view it crashes. This is my code for the app loading up (which i put in the app delegate)

Code:
#import <UIKit/UIKit.h>
#import "OpeningViewController.h"

@interface SF1AppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
    UIWindow *window;
    UITabBarController *tabBarController;
	OpeningViewController *openingView;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
@property (nonatomic, retain) IBOutlet OpeningViewController *openingView;

- (void)startTimer;
- (void)tabBarSwitch;

@end

Code:
#import "SF1AppDelegate.h"
#import "OpeningViewController.h"

@implementation SF1AppDelegate

@synthesize window;
@synthesize tabBarController;
@synthesize openingView;


- (void)applicationDidFinishLaunching:(UIApplication *)application {
    
    // Add the tab bar controller's current view as a subview of the window
	[window addSubview:openingView.view];
	[self startTimer];
}

- (void)startTimer {
	SEL methodSelector = @selector(tabBarSwitch);
	
	// 2 second timer that will call the tabBarSwitch method
	[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:methodSelector userInfo:nil repeats:NO];
}

/*
 Switches over to the Tab Bar Controller's View
 */
- (void)tabBarSwitch {
	[self presentModalViewController:tabBarController animated:YES];
}

When I run this xCode does show a warning for the only line in the tabBarSwitch method:
warning: 'SF1AppDelegate' may not respond to '-presentModalViewController:animated:'

I realize that I'm calling " [self presentModalViewController:tabBarController animated:YES]; " and self is the appDelegate... but i dont know how else i would go about making this work. If anyone has any ideas about what would cause this, I would greatly appreciate it.
 

Trending Posts

Forum statistics

Threads
260,364
Messages
1,766,559
Members
441,240
Latest member
smitty22d2