1.獲取當(dāng)前工程版本號
NSString * version = [[NSBundle mainBundle]infoDictionary]objectForKey:@"CFBundleShortVersionString"];
2.獲取當(dāng)前設(shè)備序列號唯一標(biāo)識
NSString *UUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
3.將狀態(tài)欄文字設(shè)置成白色俱病;導(dǎo)航欄設(shè)置成黑色粱甫;標(biāo)簽欄設(shè)置成黑色,上面的圖標(biāo)耀怜,文字為白色恢着。
//狀態(tài)欄顏色
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
//導(dǎo)航欄
UINavigationBar *bar = [UINavigationBar appearance];
[bar setBarStyle:UIBarStyleBlack];
//標(biāo)簽欄
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();
//設(shè)置一個圖片的存儲路徑
NSString *qianziPhotoPath = [path_sandox stringByAppendingString:@"/Documents/qianziPhoto.png"];
//把圖片直接保存到指定的路徑(同時應(yīng)該把圖片的路徑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];
}