UI中對于選擇主題的處理方法-創(chuàng)新互聯(lián)

- (instancetype)init

成都創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供東營區(qū)網(wǎng)站建設、東營區(qū)做網(wǎng)站、東營區(qū)網(wǎng)站設計、東營區(qū)網(wǎng)站制作等企業(yè)網(wǎng)站建設、網(wǎng)頁設計與制作、東營區(qū)企業(yè)網(wǎng)站模板建站服務,十載東營區(qū)做網(wǎng)站經(jīng)驗,不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡服務。

{

  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];

  //設置透明度

  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è)提供香港、美國云服務器,動態(tài)BGP最優(yōu)骨干路由自動選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡助力業(yè)務部署。公司持有工信部辦法的idc、isp許可證, 機房獨有T級流量清洗系統(tǒng)配攻擊溯源,準確進行流量調(diào)度,確保服務器高可用性。佳節(jié)活動現(xiàn)已開啟,新人活動云服務器買多久送多久。

標題名稱:UI中對于選擇主題的處理方法-創(chuàng)新互聯(lián)
網(wǎng)頁路徑:http://www.muchs.cn/article20/deogjo.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供Google云服務器、搜索引擎優(yōu)化、用戶體驗微信公眾號、企業(yè)網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

h5響應式網(wǎng)站建設