XUI 1.1.2

XUI 1.1.2

i_82 维护。



XUI 1.1.2

  • Lessica

XUI

CI Status Cocoapods

// XUI in a single line
[XUIListViewController presentFromTopViewControllerWithDictionary:@{  @"items": { @"default": @YES, @"label": @"Feature", @"cell": @"Switch", @"key": @"switch1" } }];

5 分钟内制作一个配置型 UITableView?让我们来做吧!

XUI 是 iOS 上 "设置应用架构" 的一个 直接替代品。它允许应用程序通过创建一个简单的配置包(类似于 "Settings.bundle")来显示偏好设置视图控制器。

特性

  • 数据持久化 (NSUserDefaults / 自定义适配器)
  • 本地化字符串 / 图片资源
  • 自定义单元格 (运行时)
  • 通知

组件

XUI 提供的组件比私有框架 "Preferences.framework" 更丰富

  • 链接(子面板)
  • 开关
  • 按钮(动作)
  • 文本字段
  • 单选/复选框组
  • 分段组
  • 单选选项列表
  • 多选选项列表
  • 顺序多选选项列表
  • 滑块
  • 步进器
  • 日期时间选择器
  • 标题值
  • 静态文本
  • 文本区域
  • 图片
  • 可编辑列表(字符串)

使用方法

// to specify the path for Settings.bundle
NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"];

// to specify the root entry for that bundle
NSString *xuiPath = [[NSBundle bundleWithPath:bundlePath] pathForResource:@"Root" ofType:@"plist"];

// present or push it!
XUIListViewController *xuiController = [[XUIListViewController alloc] initWithPath:xuiPath withBundlePath:bundlePath];
XUINavigationController *navController = [[XUINavigationController alloc] initWithRootViewController:xuiController];
[self presentViewController:navController animated:YES completion:nil];
NSString *xuiPath = [[NSBundle bundleWithPath:bundlePath] pathForResource:@"Root" ofType:@"plist"];

// directly present XUI from the top most view controller
[XUIListViewController presentFromTopViewControllerWithPath:xuiPath];

配置

如果没有设置键defaults,配置将保存到“标准用户默认值”。

NSNumber *enabled = [[NSUserDefaults standardUserDefaults] objectForKey:@"enabled"];
[enabled boolValue];

通知

[NSNotificationCenter defaultCenter]接收名为XUINotificationEventValueChanged的通知。

主题

可以在theme字典中配置XUI主题。

适配器

创建自定义适配器以从任何格式的接口模式读取:plistjsonlua。适配器还处理数据持久性通知

记录器

要知道我们的接口模式中是否存在任何无效的部分...

自定义单元格

继承自XUIBaseCell后,就可以尽情享受自己的单元格了,无论是基于xib的布局还是其他类型的布局。XUI会在运行时自动加载自定义单元格。

更多信息文档

https://kb.xxtouch.com/XUI/

示例

要运行示例项目,请先从 Example 目录中克隆存储库,然后运行 pod install

Demo

要求

  • Xcode 7 或更高版本
  • iOS 7 或更高版本
  • Objective-C (ARC)
  • iPhone / iPad 兼容

安装

XUI 通过 CocoaPods 提供。要安装,只需将以下行添加到您的 Podfile

pod 'XUI', :git => "https://github.com/Lessica/XUI.git"

作者

Lessica, [email protected]

许可

XUI 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。

相关项目