AppDelegate.h
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property(nonatomic, strong) UITabBarController* tabBarController;
@end
AppDelegate.m
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[EJCacheService sharedCacheService] initialize];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
MyViewController * myViewController = [[MyViewController alloc] init];
myViewController.tabBarItem.title = @"MyViewController";
self.tabBarController = [[UITabBarController alloc]init];
self.tabBarController.viewControllers = @[myViewController];
// Login and Splash setup
LoginViewController *loginViewController = [[LoginViewController alloc] init];
// If you want a navigation controller because your login has varius steps or something
// UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController: loginViewController];
// navigationController.navigationBarHidden = YES;
// self.window.rootViewController = navigationController;
// else
/self.window.rootViewController = loginViewController;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
...
@end
LoginViewController.m
Somewhere inside your LoginViewController you will push the TabBarController:
AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
[UIView transitionWithView:appDelegate.window duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
appDelegate.window.rootViewController = appDelegate.tabBarController;
} completion:nil];
No hay comentarios:
Publicar un comentario