iphoneiphone-sdk-3.0iphone-sdk-3.2iphone-sdk-3.1.2

Display login screen before Tab bar controller


Possible Duplicate:
show a login screen before Tab bar controller?

i am designing an iphone application which should be display login screen initially, after that it should display tab bar controller with 5 tabs. Am able to launch login screen initially, but when the login button is clicked am unble to show tab bar controller, kindly help me out with the code. here is my code: this is a view based application. Here is my code:

delegate.h

@interface iphoneAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;

     IphineViewController *viewController;
    IBOutlet UITabBarController *aTabBarController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

@property (nonatomic, retain) IBOutlet IphoneViewController *viewController;

@property (nonatomic, retain) IBOutlet UITabBarController *aTabBarController;

@end

delegate.M

-(void)applicationDidFinishLaunching:(UIApplication *)application {  

// Override point for customization after app launch 

   [window addSubview:viewController.view]; 

   [window makeKeyAndVisible];

   LoginView *loginView=[[LoginView alloc]initWithNibName:@"LoginView" bundle:nil];

   [window addSubview:loginView.view];

}

loginView.M

TabBarController *tabBarController = [[TabBarController alloc]initWithNibName:@"TabBarController" bundle:nil];

    [self.view addSubView: tabBarController.view];


    [tabBarController release];

my question is:

1)can i use tab bar controller in the login view. I have declared ta bar in the delegate.h If this not correct how to use tab bar controller in my loginview.m


Solution

  • I think you have chosen wrong application layout. You should choose window based application. Then what you need to do is that first you set your login screen in the window of application and then once the login button is pressed you set your tabbar controller in the window of application. Just try it.