代码:<pre><code>
//*
*
根据自己写入沙盒的plist文件来判断是第几次加载,
如果是第一次加载那么就进入引导视图,
否则进入主界面
*
*/
NSString *path = [NSHomeDirectory()stringByAppendingPathComponent:@"Documents/dic.plist"];
//读取本地的字典
NSDictionary *isFirstDic = [NSDictionary dictionaryWithContentsOfFile:path];
BOOL notFirst = [[isFirstDic objectForKey:@"notFirst"]boolValue];//第一次返回的是NO
if (notFirst) {
//不是第一次则直接进入到主界面
LauchViewController *launchVC = [[LauchViewController alloc] init];
_window.rootViewController = launchVC;
} else {
//进入导航界面
GuideViewController *guideVC = [[GuideViewController alloc] init];
_window.rootViewController = guideVC;
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
[dic setObject:@"YES" forKey:@"notFirst"];
[dic writeToFile:path atomically:YES];
}
网友评论