1.获取当前工程版本号
NSString * version = [[NSBundle mainBundle]infoDictionary]objectForKey:@"CFBundleShortVersionString"];
2.获取当前设备序列号唯一标识
NSString *UUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
3.将状态栏文字设置成白色;导航栏设置成黑色;标签栏设置成黑色,上面的图标,文字为白色。
//状态栏颜色
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
//导航栏
UINavigationBar *bar = [UINavigationBar appearance];
[bar setBarStyle:UIBarStyleBlack];
//标签栏
UITabBar *tabBar = [UITabBar appearance];
[tabBar setBarStyle:UIBarStyleBlack];
[tabBar setTintColor:[UIColor whiteColor]];
4.加载本地html
UIWebView *webView = [[UIWebView alloc]initWithFrame:SCREEN];
NSString *path = [[NSBundle mainBundle]bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
NSString *htmlPath = [[NSBundle mainBundle]pathForResource:self.nameStr ofType:@"html"];
NSLog(@"%@",htmlPath);
NSString *htmlStr = [NSString stringWithContentsOfFile:htmlPath encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:htmlStr baseURL:baseURL];
[self.view addSubview:webView];
5.缓存与加载图片
if (self.qianziphoto != nil) {
NSString *path_sandox = NSHomeDirectory();
//设置一个图片的存储路径
NSString *qianziPhotoPath = [path_sandox stringByAppendingString:@"/Documents/qianziPhoto.png"];
//把图片直接保存到指定的路径(同时应该把图片的路径imagePath存起来,下次就可以直接用来取)
[UIImagePNGRepresentation(self.qianziphoto) writeToFile:qianziPhotoPath atomically:YES];
//保存路径
param[@"idcardFrontFile"] = qianziPhotoPath;
}
[defaults setObject:param forKey:@"Activate"];
//取
self.qianziphoto = [[UIImage alloc] initWithContentsOfFile: [defaults objectForKey:@"Activate"][@"idcardFrontFile"] ];
if (self.qianziphoto != nil) {
[_qianziBtn setImage:self.qianziphoto forState:UIControlStateNormal];
}else{
[_qianziBtn setImage:[UIImage imageNamed:@"add_photo2@2x"] forState:UIControlStateNormal];
}