- (instancetype)init
成都創(chuàng)新互聯(lián)公司專(zhuān)業(yè)為企業(yè)提供東營(yíng)區(qū)網(wǎng)站建設(shè)、東營(yíng)區(qū)做網(wǎng)站、東營(yíng)區(qū)網(wǎng)站設(shè)計(jì)、東營(yíng)區(qū)網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、東營(yíng)區(qū)企業(yè)網(wǎng)站模板建站服務(wù),十載東營(yíng)區(qū)做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。{
self = [super init];
if (self) {//初始化_themeName
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *key = [defaults objectForKey:KThemeDefaultKey];
if (key.length == 0) {
_themeName = @"New PinkPink";
} else{
_themeName = key;
}
//獲取文件路徑
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"theme" ofType:@"plist"];
//初始化_themeConfiger
_themeConfiger = [NSDictionary dictionaryWithContentsOfFile:filePath];
//取得狀態(tài)欄狀態(tài)
[self initTabBarStyle];
}
return self;
}
//創(chuàng)建單例
+ (ThemeManager *)shareThemeManage{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
themeManage = [[ThemeManager alloc]init];
});
return themeManage;
}
//根據(jù)p_w_picpathName返回圖片
- (UIImage *)themeImageWithImageName:(NSString *)p_w_picpathName{
//獲取文件路徑
NSString *themePath = [[[NSBundle mainBundle]resourcePath]stringByAppendingFormat:@"/%@/%@",_themeConfiger[_themeName],p_w_picpathName];
return [UIImage p_w_picpathWithContentsOfFile:themePath];
}
//根據(jù)textcolorName返回顏色
- (UIColor *)textColorWithTextColorName:(NSString *)textcolorName{
//獲取文件路徑
NSString *filePath = [[[NSBundle mainBundle]resourcePath]stringByAppendingFormat:@"/%@/config.plist",_themeConfiger[_themeName]];
NSDictionary *dicTheme = [NSDictionary dictionaryWithContentsOfFile:filePath];
NSDictionary *dicColor = dicTheme[textcolorName];
//設(shè)置透明度
NSInteger alpha = dicColor.count >= 4 ? [[dicColor objectForKey:@"alpha"] integerValue]: 1;
return [UIColor colorWithRed:[[dicColor objectForKey:@"R"] floatValue] / 255 green:[[dicColor objectForKey:@"G"] floatValue] / 255 blue:[[dicColor objectForKey:@"B"] floatValue] / 255 alpha:alpha];
}
- (void)setThemeName:(NSString *)themeName{
if (_themeName != themeName) {
_themeName = themeName;
[self initTabBarStyle];
//修改數(shù)據(jù)
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:_themeName forKey:KThemeDefaultKey];
[defaults synchronize];
//發(fā)出通知
[[NSNotificationCenter defaultCenter]postNotificationName:NotificationTheme object:nil];
}
}
- (void)initTabBarStyle{
//獲取文件路徑
NSString *filePath = [[[NSBundle mainBundle]resourcePath]stringByAppendingFormat:@"/%@/config.plist",_themeConfiger[_themeName]];
NSDictionary *dicTheme = [NSDictionary dictionaryWithContentsOfFile:filePath];
_tarBarStyle = [[dicTheme objectForKey:@"Statusbar_Style"] integerValue];
}
創(chuàng)新互聯(lián)www.cdcxhl.cn,專(zhuān)業(yè)提供香港、美國(guó)云服務(wù)器,動(dòng)態(tài)BGP最優(yōu)骨干路由自動(dòng)選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務(wù)部署。公司持有工信部辦法的idc、isp許可證, 機(jī)房獨(dú)有T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確進(jìn)行流量調(diào)度,確保服務(wù)器高可用性。佳節(jié)活動(dòng)現(xiàn)已開(kāi)啟,新人活動(dòng)云服務(wù)器買(mǎi)多久送多久。