zoukankan      html  css  js  c++  java
  • 新特性界面

    1.当第一次安装或版本升级时显示新特性界面

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        
         // 1.创建window
        self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
        self.window.backgroundColor = [UIColor whiteColor];
        
        // 2.根据版本号判断是否选择新特性
        [self checkNewFeatureVC];
        
        // 3.显示window
        [self.window makeKeyAndVisible];
        
        return YES;
    }
    
    - (void)checkNewFeatureVC{
        // 2-1.获取软件自身版本
        NSDictionary *infoDict = [NSBundle mainBundle].infoDictionary;
        NSString *currentVersion = infoDict[@"CFBundleShortVersionString"];
        
        // 2-2.获取沙盒中存储的版本号
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        NSString *sandboxVersion = [defaults objectForKey:@"oldVersion"];
        
        // 2-3.比较两个版本号,如果软件自身大于沙盒的,保存软件自身的,显示新特性
        
        if([currentVersion compare:sandboxVersion] == NSOrderedDescending){//当前系统版本号和沙盒版本号比较,如果降序
            self.window.rootViewController = [[NewFeatureViewController alloc]init];
            
            //2-4.将新版本号保存到沙盒
            [[NSUserDefaults standardUserDefaults]setObject:currentVersion forKey:@"oldVersion"];
            
        }else{
            self.window.rootViewController = [[ViewController alloc]init];
        }
    
    }
  • 相关阅读:
    通过url在两个页面之间传值
    $.ajax数据传输成功却执行失败的回调函数
    5.26小测
    洛谷——AC记
    7.2模拟赛
    6.30模拟赛
    洛谷——每日一题
    洛谷——动态规划
    致创营
    BSGS
  • 原文地址:https://www.cnblogs.com/jiayongqiang/p/5755993.html
Copyright © 2011-2022 走看看