zoukankan      html  css  js  c++  java
  • 多层导航栏下的登陆注销架构

    1.APPDelegate创建一个Nav,作为主Nav:

    //.h
    
    @property (strong, nonatomic) LoginController *login_ctr;
    
    @property (strong, nonatomic) UINavigationController *login_nav;
    
    //.m
    
    self.login_ctr = [[LoginController alloc] init];
    
    self.login_nav = [[UINavigationController alloc] initWithRootViewController:self.login_ctr];
    
    self.window.rootViewController = self.login_nav;

    2.Login界面创建tab控制器,并添加各个子Nav:

    HomeController *home_ctr = [[HomeController alloc] init];
    
    home_ctr.title = @"首页";
    
    UINavigationController *home_nav = [[UINavigationController alloc] initWithRootViewController:home_ctr];
    
    DeviceController *device_ctr = [[DeviceController alloc] init];
    
    device_ctr.title = @"设备列表";
    
    UINavigationController *device_nav = [[UINavigationController alloc] initWithRootViewController:device_ctr];
    
     
    
    UITabBarController *rootTabbarCtr  = [[UITabBarController alloc] init];
    
    NSArray *nav_views = @[home_nav,device_nav];
    
    [rootTabbarCtr setViewControllers:nav_views];
    
     
    
    [self.navigationController pushViewController:rootTabbarCtr animated:YES];

    3.在需要返回最上层Login界面时调用:

    AppDelegate *app = (AppDelegate *)[[UIApplication  sharedApplication] delegate];
    
    [app.login_nav popToRootViewControllerAnimated:YES];

     

  • 相关阅读:
    BZOJ 1150 [CTSC2007]数据备份Backup(贪心+优先队列)
    BZOJ 1053 [HAOI2007]反素数ant(约数个数)
    BZOJ 1066 [SCOI2007]蜥蜴(最大流)
    CodeForces 772A Voltage Keepsake
    HDU 6030 Happy Necklace
    HDU 6031 Innumerable Ancestors
    HDU 6026 Deleting Edges
    HDU 6024 Building Shops
    HDU 6029 Graph Theory
    HDU 6025 Coprime Sequence
  • 原文地址:https://www.cnblogs.com/ramboback/p/5458638.html
Copyright © 2011-2022 走看看