iOS 每次登录进入首页

来源:互联网 发布:神奈川县湘北赤木数据 编辑:程序博客网 时间:2024/06/10 03:39

(超时、其他设备登录)退出登录后,每次登录进入系统首页

1.AppDelegate.h

-(void)showWindowHome:(NSString *)windowType;


2.AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [selfcreatNavigationWindow];

    returnYES;

}

-(void)showWindowHome:(NSString *)windowType{

    if([windowTypeisEqualToString:@"logout"]){

        [selfcreatNavigationWindow];

    }

}

//创建

- (void)creatNavigationWindow{

    CPPayViewController * cpPayVC=[[CPPayViewControlleralloc]init];

    CPBillViewController * cpBillVC=[[CPBillViewControlleralloc]init];

    CPMyViewController * cpMyVC=[[CPMyViewControlleralloc]init];

    UITabBarController *tabBC = [[UITabBarControlleralloc]init];

    tabBC.viewControllers =@[[[UINavigationControlleralloc]initWithRootViewController:cpPayVC], [[UINavigationControlleralloc]initWithRootViewController:cpBillVC],[[UINavigationControlleralloc]initWithRootViewController:cpMyVC]];

    self.window.rootViewController = tabBC;

    tabBC.tabBar.barTintColor = [UIColorwhiteColor];

    tabBC.tabBar.translucent =NO;

    tabBC.tabBar.tintColor = [UIColororangeColor];

    NSArray * array =@[@"首页",@"账单",@"我的"];

    for (int i=0; i<array.count; i++) {

        UINavigationController *naVC = tabBC.viewControllers[i];

               [naVC.navigationBarsetBackgroundImage:[UIImageimageNamed:@"navigationbar"]forBarMetrics:UIBarMetricsDefault];

            naVC.tabBarItem = [[UITabBarItemalloc]initWithTitle:array[i]image:[[UIImageimageNamed:[NSStringstringWithFormat:@"TabBar_HomeBar%d.png",i]]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]selectedImage:[[UIImageimageNamed:[NSStringstringWithFormat:@"TabBar_%d.png",i]]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] ];

    }

}

3.登录 login.m中

[(AppDelegate *)[UIApplicationsharedApplication].delegateshowWindowHome:@"logout"];




0 0
原创粉丝点击