大发体育娱乐在线-大发体育娱乐官方网站-大发体育娱乐登录网址
做最好的网站

新特色相比较,根据使用版本判别是还是不是必

来源:http://www.dfwstonefabricators.com 作者:编程应用 人气:70 发布时间:2019-09-19
摘要:先捉弄一下。。。。。。脑子太笨,没转过来弯,第叁遍没掌握供给弄成了登入成功后在此运转没有须求指导页,然后老大说不对,是第一遍接纳安装后首先次开发银行引导页之后依据

先捉弄一下。。。。。。脑子太笨,没转过来弯,第叁遍没掌握供给弄成了登入成功后在此运转没有须求指导页,然后老大说不对,是第一遍接纳安装后首先次开发银行引导页之后依据版本来剖断是否要求运行携带页;

IOS9 新特性

原理:获取当前应用版本消息存入沙河中,之后与沙河中的音讯相比来剖断是或不是须要指点页;

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

//获取APP版本号,将版本号作为Key,存款和储蓄在NSuserDefault中,初此安装张开时,key是官样文章的,即步入辅导页面,之后将此key保存起来(保险前面包车型地铁推断不会再步入)app升级后,推断新版本号的key,发掘并未,即显示新本子的指导页面,然后将Key保存起来,依此类推。

#pragma mark -荧屏适配

代码如下:

NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];

NSString *currentVerisonId = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];

//安装后率先次开行教导页

if ([userDefaults boolForKey:currentVerisonId]) {

CRMLoginViewController *loginVC = [[CRMLoginViewController alloc] init];

self.window.rootViewController = loginVC;

}else{

CRMGuidePageViewController *guidePageVC = [[CRMGuidePageViewController alloc] init];

self.window.rootViewController = guidePageVC;

[userDefaults setBool:YES forKey:currentVerisonId];

[userDefaults synchronize];

}

UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

实则想想很简短,正是一心急就错了和谐都找不到错在哪,旁人看后很简答的,很轻便的就找到了。。。。。

self.window = window;

[NSThread sleepForTimeInterval:1.0];

//推断是不是须求出示:(内部已经挂念版本及本地版本缓存)

BOOL canShow = [GuidePageViewController canShowNewFeature];

//测验代码,正式版本应该删除

canShow = YES;

if(canShow){ // 起头化新特点分界面

window.rootViewController = [GuidePageViewController newFeatureVCWithImageNames:@[@"new1",@"new2",@"new3",@"new3"] enterBlock:^{

NSLog(@"踏向主页面");

[self enter];

} configuration:^(UIButton *enterButton) { // 配置步向按键

[enterButton setBackgroundImage:[UIImage imageNamed:@"btn_nor"] forState:UIControlStateNormal];

[enterButton setBackgroundImage:[UIImage imageNamed:@"btn_pressed"] forState:UIControlStateHighlighted];

enterButton.bounds = CGRectMake(0, 0, 120, 40);

enterButton.center = CGPointMake(KScreenW * 0.5, KScreenH* 0.85);

}];

}else{

[self enter];

}

[window makeKeyAndVisible];

return YES;

}

###IOS9前版本

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

// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];

NSString* key = (NSString *)kCFBundleVersionKey;

//1.从Info.plist收取版本号

NSString* version = [NSBundle mainBundle].infoDictionary[key];

//2.从沙盒中抽出上次积攒的版本号

NSString* saveVersion = [[NSUserDefaults standardUserDefaults] objectForKey:key];

if([version isEqualToString:saveVersion])

{

self.window.rootViewController = [[ MainviewController alloc]init];

}else{  //将新本子写入沙盒

[[NSUserDefaults standardUserDefaults]setObject:version forKey:key];

[[NSUserDefaults standardUserDefaults]synchronize];//立时存款和储蓄

self.window.rootViewController = [[NewFeatureController alloc]init];

}

}

本文由大发体育娱乐在线发布于编程应用,转载请注明出处:新特色相比较,根据使用版本判别是还是不是必

关键词:

上一篇:没有了

下一篇:没有了

最火资讯