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];

     

  • 相关阅读:
    转:高并发场景下强一致预算/库存扣减方案
    转:Dubbo性能调优参数及原理
    转:java线程状态说明,Jstack线程状态BLOCKED/TIMED_WAITING/WAITING解释
    使用增强学习法之SQ3R主动阅读
    建立实用投资计划
    使用smarty方法实现目标
    主动学习
    小知识
    大脑的处理模式
    真正的随笔
  • 原文地址:https://www.cnblogs.com/ramboback/p/5458638.html
Copyright © 2011-2022 走看看