BDVRSettingsItem.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // BDVRSettingsItem.m
  3. // BDVRClientDemo
  4. //
  5. // Created by baidu on 16/3/14.
  6. // Copyright © 2016年 baidu. All rights reserved.
  7. //
  8. #import "BDVRSettingsItem.h"
  9. NSString *kKeyKey = @"setting_item_key";
  10. NSString *kTitleKey = @"setting_item_title";
  11. NSString *kGroupTypeKey = @"setting_item_group_type";
  12. NSString *kCellTypeKey = @"setting_item_cell_type";
  13. NSString *kCurItemValueKey = @"setting_cur_item_value";
  14. NSString *kDetailDicKey = @"setting_detail_dic_key";
  15. @implementation BDVRSettingsItem
  16. - (void)encodeWithCoder:(NSCoder *)encoder{
  17. [encoder encodeObject:self.itemKey forKey:kKeyKey];
  18. [encoder encodeObject:self.itemTitle forKey:kTitleKey];
  19. [encoder encodeObject:@(self.groupType) forKey:kGroupTypeKey];
  20. [encoder encodeObject:@(self.cellType) forKey:kCellTypeKey];
  21. [encoder encodeObject:self.curItemValue forKey:kCurItemValueKey];
  22. [encoder encodeObject:self.detailDictionary forKey:kDetailDicKey];
  23. }
  24. - (id)initWithCoder:(NSCoder *)decoder {
  25. if((self = [super init])) {
  26. self.itemKey = [decoder decodeObjectForKey:kKeyKey];
  27. self.itemTitle = [decoder decodeObjectForKey:kTitleKey];
  28. self.groupType = [[decoder decodeObjectForKey:kGroupTypeKey] intValue];
  29. self.cellType = [[decoder decodeObjectForKey:kCellTypeKey] intValue];
  30. self.curItemValue = [decoder decodeObjectForKey:kCurItemValueKey];
  31. self.detailDictionary = [decoder decodeObjectForKey:kDetailDicKey];
  32. }
  33. return self;
  34. }
  35. - (instancetype)initWithItemTitle:(NSString *)itemTitle
  36. itemKey:(NSString *)itemKey
  37. groupType:(TBDSettingsGroupType)groupType
  38. cellType:(TBDSettingsCellType)cellType
  39. curItemValue:(id)curItemValue
  40. detailDictionary:(NSDictionary *)detailDictionary {
  41. if (self = [super init]) {
  42. self.itemTitle = itemTitle;
  43. self.itemKey = itemKey;
  44. self.groupType = groupType;
  45. self.cellType = cellType;
  46. self.curItemValue = curItemValue;
  47. self.detailDictionary = detailDictionary;
  48. }
  49. return self;
  50. }
  51. @end