zoukankan      html  css  js  c++  java
  • iphone 程序自动登陆

    场景介绍

    app 里有一个有一个UITabBarController,在进入UITabBarController之前要验证用户是否已经登陆,如果没有登陆就弹出一个对话框,让用户输入登陆信息。

     

    实现方式

    1.在appDelegate。h里声明一个变量,用来绑定UITableController:

    UITabBarController *tabbarController;

    2.在appDelegate。m里添加如下方法

    - (void)applicationDidFinishLaunching:(UIApplication *)application {    

        // Override point for customization after app launch    

       [window addSubview:tabbarController.view];
       [window makeKeyAndVisible];}

      

    //背景图片

        window.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"wallpaper.png"]];

        [UIApplication sharedApplication].statusBarHidden = NO;


     //如果没有登录,就执行如下方法啊:

    loginViewController *login = [[loginViewControlleralloc] initWithNibName:@"loginViewController"bundle:[NSBundlemainBundle]];UINavigationController *nav = [[UINavigationControlleralloc] initWithRootViewController:login];

    [self.tabbarControllersetModalTransitionStyle:UIModalTransitionStyleCoverVertical];

    [self.tabbarControllerpresentModalViewController:nav animated:YES];

     
    3.在弹出的View的login执行方法里最后执行如下方法

    -(IBAction)login

    {

    NSLog(@"login press");
    [selfdismissModalViewControllerAnimated:YES];

    }

     
  • 相关阅读:
    python3 网络编程
    python3 字典及其方法
    洛谷P2239 螺旋矩阵
    洛谷P4281 紧急会议
    洛谷 P4427 求和
    树的直径
    洛谷P3398 仓鼠找suger
    洛谷P3865 ST表
    洛谷P1638逛画展
    洛谷P1886 滑动窗口
  • 原文地址:https://www.cnblogs.com/likwo/p/1790775.html
Copyright © 2011-2022 走看看