OzBoz
OzBoz

Reputation: 543

Storyboard UITabBarController

I am trying to build an application for iphone with using storyboard that starting with login screen and after user touch the login button, it should check it with authentication method. But, i could not directly link the login button to UITabBarController, because when user touch the button it directly goes the Tab Bar page without checking the login method. And also i tried to create mytabBar class it extends from UITabBarController and I set UITabBarController in custom classs as mytabBar in storyboard. Then I putted in my login view controller class;

#import "tabBar.h" 
- (IBAction)loginCheck:(id)sender{

    tabBar *tabbar = [[tabBar alloc] initWithNibName:nil bundle:nil];
    [self presentModalViewController:tabbar animated:YES];
}

but it still does not working.

Upvotes: 0

Views: 2584

Answers (1)

DAS
DAS

Reputation: 1941

What type is tabBar? There is no check in this method. Maybe do:

//...
NSLog(@"Log");
//...

... in the method to be sure it gets called.

Whenever you are working with UIStoryboard you are doing something like this instead of initializing a new instance of tabBar:

- (void)showModalAssistantViewController
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; //Put your right Storyboard Name here
tabBar *viewController = [storyboard instantiateViewControllerWithIdentifier:@"TabBarController"]; //Put your right identifier here
[viewController setModalPresentationStyle:UIModalPresentationFullScreen];
[viewController setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self.navigationController presentModalViewController:viewController animated:YES];
}

... The identifier can be found in the ViewController's Inspector-Tab in IB.

Upvotes: 1

Related Questions