Time to upgrade! Get an iPhone 12 mini + Unlimited Data for $60/mo
- 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]; }
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.01-26-2010 02:56 PMLike 0
- Forum
- Developers
- The Developer's Lounge
Opening View Crashes
LINK TO POST COPIED TO CLIPBOARD