Tuesday 4 April 2017

Login (navigation controller + tabbar controller)





 if (![[NSUserDefaults standardUserDefaults] objectForKey:@"is_first_time"])
    {
        [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:YES] forKey:@"is_first_time"];
        
        [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"0"] forKey:@"is_Login"];
        [[NSUserDefaults standardUserDefaults] setObject:@"" forKey:@"Drinn_deviceToken"];

    }
    NSString *is_Login=[[NSUserDefaults standardUserDefaults] objectForKey:@"is_Login"];
    
    
        if ([is_Login isEqualToString:@"0"])
    {
        self.viewController = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
        
        
        self.navigationController=[[UINavigationController alloc] initWithRootViewController:self.viewController];
        
        self.window.rootViewController = self.navigationController;
        
        self.navigationController.navigationBar.barTintColor =[ UIColor colorWithRed:212.0/255.0 green:34.0/255.0 blue:75.0/255.0 alpha:1.0];
        self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    }
    else
    {
        self.viewController = [storyboard instantiateViewControllerWithIdentifier:@"HomePageview"];
        
        
        UITabBarController *myTab = [storyboard instantiateViewControllerWithIdentifier:@"HomePageview"];
        
        self.navigationController=[[UINavigationController alloc] initWithRootViewController:myTab];
        self.navigationController.navigationBar.barTintColor =[ UIColor colorWithRed:212.0/255.0 green:34.0/255.0 blue:75.0/255.0 alpha:1.0];
        self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

        self.window.rootViewController = self.navigationController;
        


    }

No comments:

Post a Comment