- (instancetype)init
成都創(chuàng)新互聯(liá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,專業(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ù)器買多久送多久。
標(biāo)題名稱:UI中對(duì)于選擇主題的處理方法-創(chuàng)新互聯(lián)
網(wǎng)頁(yè)路徑:http://m.newbst.com/article20/deogjo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、云服務(wù)器、搜索引擎優(yōu)化、用戶體驗(yàn)、微信公眾號(hào)、企業(yè)網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容