VOPreference 0.1.0

VOPreference 0.1.0

Valo Lee维护。



  • 作者:
  • pozi119

VOPreference

CI Status Version License Platform

功能

  • 组标题,组页脚
  • 文本
  • 多个值
  • 文本框
  • 切换开关
  • 滑块
  • 按钮
  • 带值的步进器
  • 日期/时间选择器
  • 分段控制器
  • 分段滑块

用法

  1. 使用XCode文件模板,添加setting.bundle
  2. 将setting.bundle中的plist文件复制到项目中
  3. 使用代码创建并跳转到设置页面,示例如下:
    NSString *path = [[NSBundle mainBundle] pathForResource:@"manual" ofType:@"plist"];
    VPSetting *setting = [[VPSetting alloc] initWithEntiresFile:path];
    VOPreferenceController *settingVC = [[VOPreferenceController alloc] init];
    settingVC.setting = setting;
    [self.navigationController pushViewController:settingVC animated:YES];

注意:

默认使用NSUserDefaults保存配置,也可以设置为其他保存方式。

    [setting setValueForEntryKey:^id(NSString * entryKey) {
        // load val for entryKey
    }];
    [setting setSetValueForEntryKey:^(NSString *  entryKey, id val) {
        // save val for entryKey
    }];

要求

安装

VOPreference可以通过CocoaPods获取。要安装它,只需将以下行添加到您的Podfile中

pod 'VOPreference'

作者

pozi119,[email protected]

许可

VOPreference在MIT许可下可用。有关更多信息,请参阅LICENSE文件。