Welcome to the iMore Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 1 of 1
  1. Thread AuthorThread Author   #1  
    ngd12's Avatar
    iPhone Nanite

    1 Posts

    Default Opening View Crashes

    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)

    #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;
    #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.

Posting Permissions