I have an application containing a tab bar view and I have a login xib(login.xib) and its corresponding class files(LoginController) in the same application. I want that when my application launches, the login file should be loaded first and then once I click on the login button, my TabBar View should be launched.
Tried a lot many ways, but nothing worked. :(
Latest one is I tried putting the following code in the AppDelegate file at the end of application didFinishLaunchingWithOptions but facing an error:
loginController = [[LoginController alloc] init];
[window addSubview:tabcontroller.view];
[window addSubview:loginController.view];
[window makeKeyAndVisible];
return YES;
Error is "loginController" is undeclared.
Am I missing something. Please let me know if there are any other ways through which I can fulfill my requirement.
Also, on clickButton() in开发者_高级运维side the login, I am using event Touch Up Inside.
loginController = [[LoginController alloc] initWithNibName:@"login" bundle:nil];
[window addSubview:loginController.view];
[window makeKeyAndVisible];
Add following line when you have finished your login checks.
[window addSubview:tabcontroller.view];
Also, please check where the loginCont is used?
Thanks,
Just try using:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
UIView *indicatorView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
UIImageView *splashV=[[UIImageView alloc]initWithFrame:CGRectMake(0, 20, 320, 460)];
[splashV setImage:[UIImage imageNamed:@"Default.png"]];
[indicatorView setBackgroundColor:[UIColor clearColor]];
[indicatorView addSubview:splashV];
[self.window addSubview:indicatorView];
//Take button check credentials on successful login call StopViewOnsuccessfullogin
}
-(void)StopViewOnsuccessfullogin
{
[indicatorView removeFromSuperview];
[splashV release];
[window addSubview:tabcontroller.view];
[window makeKeyAndVisible];
}
Hope that will work .....
One way to do it is to change the view controller property of the AppDelegate in Interface Builder to your new View Controller's XIB file.
Move the Tab Bar & associated view controllers into another nib, and only load that once the login screen is finished.
精彩评论