SDForms 0.9.3

SDForms 0.9.3

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年7月

Rafał Kwiatkowski 维护。



SDForms 0.9.3

SDForms 是一个开源的 iOS forms 库,允许创建基于 UITableView 的动态表单。它提供了不同类型的字段,如文本字段、选择字段、日期选择字段、开关字段、滑动条字段等。它还允许自动将字段的值映射到对象属性。

安装

  1. 将 SDForms.xcodeproj 拖放到您的项目/工作区
  2. 在项目构建设置中,在头文件搜索路径选项中添加适当的路径
  3. 在“其他链接器标志”中添加“-all_load -ObjC”
  4. 在构建阶段选项卡的目标依赖中添加 SDForms
  5. 在链接二进制库中添加 libSDForms.a
  6. 在复制捆绑资源中添加 SDFormsResourcesBundle.bundle

使用方法

这是一个简单的示例。对于更高级的使用,请查看示例项目。

初始化表单

self.form = [[SDForm alloc] initWithTableView:self.tableView];
self.form.delegate = self;
self.form.dataSource = self;

创建字段

SDTextFormField *name = [[SDTextFormField alloc] initWithObject:self.person relatedPropertyKey:@"name"];
name.title = @"Name";
name.placeholder = @"Name";
name.cellType = SDTextFormFieldCellTypeTextAndLabel;

实现数据源方法;

- (NSInteger)numberOfSectionsForForm:(SDForm *)form
{
return self.sections.count;
}

- (NSInteger)form:(SDForm *)form numberOfFieldsInSection:(NSInteger)section
{
NSMutableArray *fields = [self.sections objectAtIndex:section];
return fields.count;
}

- (SDFormField *)form:(SDForm *)form fieldForRow:(NSInteger)row inSection:(NSInteger)section
{
NSArray *fields = [self.sections objectAtIndex:section];
return [fields objectAtIndex:row];
}

屏幕截图

Screenshot1

Screenshot2