XLForm
---------------
By [XMARTLABS](http://xmartlabs.com).
[![Build Status](https://travis-ci.org/xmartlabs/XLForm.svg?branch=master)](https://travis-ci.org/xmartlabs/XLForm)
<a href="https://cocoapods.org/pods/XLForm"><img src="https://img.shields.io/cocoapods/v/XLForm.svg" alt="CocoaPods compatible" /></a>
**If you are looking for Swift native implementation we have recently created [Eureka], a complete re-design of XLForm in Swift.** *Do not panic, We will continue maintaining and improving XLForm, obj-c rocks!!*
Purpose
--------------
XLForm is the most flexible and powerful iOS library to create dynamic table-view forms. The goal of the library is to get the same power of hand-made forms but spending 1/10 of the time.
XLForm provides a very powerful DSL (Domain Specific Language) used to create a form. It keeps track of this specification on runtime, updating the UI on the fly.
#####Let's see the iOS Calendar Event Form created using XLForm
![Screenshot of native Calendar Event Example](Examples/Objective-C/Examples/RealExamples/XLForm.gif)
What XLForm does
----------------
* Loads a form based on a declarative [*form definition*](#how-to-create-a-form "form definition").
* Keeps track of definition changes on runtime to update the form interface accordingly. Further information on [*Dynamic Forms*](#dynamic-forms---how-to-change-the-form-dynamically-at-runtime "Dynamic Forms") section of this readme.
* Supports multivalued sections allowing us to create, delete or reorder rows. For further details see [*Multivalued Sections*](#multivalued-sections-insert-delete-reorder-rows "Multivalued Sections") section bellow.
* Supports [*custom rows definition*](#how-to-create-a-custom-row).
* Supports custom selectors. For further details of how to define your own selectors check [*Custom selectors*](#custom-selectors---selector-row-with-a-custom-selector-view-controller "Custom Selectors") section out.
* Provides several inline selectors such as date picker and picker inline selectors and brings a way to create custom inline selectors.
* Form data validation based on form definition.
* Ability to easily navigate among rows, fully customizable.
* Ability to show inputAccessoryView if needed. By default a navigation input accessory view is shown.
* Read only mode for a particular row or the entire form.
* Rows can be hidden or shown depending on other rows values. This can be done declaratively using `NSPredicates`. (see [*Make a row or section invisible depending on other rows values*](#make-a-row-or-section-invisible-depending-on-other-rows-values "Using Predicates"))
## How to create a form
#### Create an instance of XLFormViewController
##### Swift
```swift
class CalendarEventFormViewController : XLFormViewController {
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
}
func initializeForm() {
// Implementation details covered in the next section.
}
}
```
##### Objective-C
```objc
#import "XLFormViewController.h"
@interface CalendarEventFormViewController: XLFormViewController
@end
```
```objc
@interface ExamplesFormViewController ()
@end
@implementation ExamplesFormViewController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self){
[self initializeForm];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self){
[self initializeForm];
}
return self;
}
- (void)initializeForm {
// Implementation details covered in the next section.
}
@end
```
##### Implementing the initializeForm method
To create a form we should declare it through a `XLFormDescriptor` instance and assign it to a `XLFormViewController` instance. As we said XLForm works based on a DSL that hides complex and boilerplate stuff without losing the power and flexibility of hand-made forms.
To define a form we use 3 classes:
* `XLFormDescriptor`
* `XLFormSectionDescriptor`
* `XLFormRowDescriptor`
A form definition is a `XLFormDescriptor` instance that contains one or more sections (`XLFormSectionDescriptor` instances) and each section contains several rows (`XLFormRowDescriptor` instance). As you may have noticed the DSL structure is analog to the structure of a `UITableView` (Table -->> Sections -- >> Rows). The resulting table-view form's structure (sections and rows order) mirrors the definition's structure.
##### Let's see an example implementation of initializeForm to define the iOS Calendar Event Form
```objc
- (void)initializeForm {
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
form = [XLFormDescriptor formDescriptorWithTitle:@"Add Event"];
// First section
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// Title
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"title" rowType:XLFormRowDescriptorTypeText];
[row.cellConfigAtConfigure setObject:@"Title" forKey:@"textField.placeholder"];
[section addFormRow:row];
// Location
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"location" rowType:XLFormRowDescriptorTypeText];
[row.cellConfigAtConfigure setObject:@"Location" forKey:@"textField.placeholder"];
[section addFormRow:row];
// Second Section
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// All-day
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"all-day" rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"All-day"];
[section addFormRow:row];
// Starts
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"starts" rowType:XLFormRowDescriptorTypeDateTimeInline title:@"Starts"];
row.value = [NSDate dateWithTimeIntervalSinceNow:60*60*24];
[section addFormRow:row];
self.form = form;
}
```
XLForm will load the table-view form from the previously explained definition. The most interesting part is that it will update the table-view form based on the form definition modifications.
That means that we are able to make changes on the table-view form adding or removing section definitions or row definitions to the form definition on runtime and you will never need to care again about `NSIndexPath`, `UITableViewDelegate`, `UITableViewDataSource` or other complexities.
**To see more complex form definitions take a look at the example application in the Examples folder of this repository. You can also run the examples on your own device if you wish.** XLForm **has no** dependencies over other pods, anyway the examples project makes use of some cocoapods to show advanced XLForm features.
## Using XLForm with Storyboards
* Perform the steps from **How to create a form**
* In Interface Builder (IB), drag-and-drop a **UIViewController** onto the Storyboard
* Associate your custom form class to the **UIViewController** using the **Identity Inspector**
How to run XLForm examples
---------------------------------
1. Clone the repository `git@github.com:xmartlabs/XLForm.git`. Optionally you can fork the repository and clone it from your own github account, this approach would be better in case you want to contribute.
2. Move to either the Objective-c or Swift [example folder](/Examples).
3. Install example project cocoapod dependencies. From inside Objective-c or Swift example folder run `pod install`.
4. Open XLForm or SwiftExample workspace using XCode and run the project. Enjoy!
Rows
---------------------
####Input Rows
![Screenshot of Input Examples](Examples/Objective-C/Examples/Inputs/XLForm-Inputs.gif)
Input rows allows the user to enter text values. Basically they use `UITextField` or `UITextView` control
没有合适的资源?快使用搜索试试~ 我知道了~
物联网结合智能硬件的优质项目.zip(毕设/课设/竞赛/实训/项目开发)(本人专注嵌入式领域)
共2032个文件
h:986个
m:768个
json:212个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 119 浏览量
2024-03-29
12:35:14
上传
评论
收藏 84.01MB ZIP 举报
温馨提示
嵌入式优质项目,资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松copy复刻,拿到资料包后可轻松复现出一样的项目。 本人单片机开发经验充足,深耕嵌入式领域,有任何使用问题欢迎随时与我联系,我会及时为你解惑,提供帮助。 【资源内容】:包含完整源码+工程文件+说明,项目具体内容可查看下方的资源详情。 【附带帮助】: 若还需要嵌入式物联网单片机相关领域开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步。 【本人专注嵌入式领域】: 有任何使用问题欢迎随时与我联系,我会及时解答,第一时间为你提供帮助,CSDN博客端可私信,为你解惑,欢迎交流。 【建议小白】: 在所有嵌入式开发中硬件部分若不会画PCB/电路,可选择根据引脚定义将其代替为面包板+杜邦线+外设模块的方式,只需轻松简单连线,下载源码烧录进去便可轻松复刻出一样的项目 【适合场景】: 相关项目设计中,皆可应用在项目开发、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面中 可借鉴此优质项目实现复刻,也可以基于此项目进行扩展来开发出更多功能
资源推荐
资源详情
资源评论
收起资源包目录
物联网结合智能硬件的优质项目.zip(毕设/课设/竞赛/实训/项目开发)(本人专注嵌入式领域) (2032个子文件)
index.css 853B
service.css 831B
大器物联接口V1.doc 125KB
.DS_Store 14KB
.DS_Store 14KB
.DS_Store 10KB
.DS_Store 10KB
.DS_Store 10KB
.DS_Store 10KB
.DS_Store 10KB
.DS_Store 8KB
.DS_Store 8KB
.DS_Store 8KB
.DS_Store 8KB
.DS_Store 8KB
.DS_Store 8KB
.DS_Store 8KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
BMKVersion.h 60KB
BMKMapView.h 25KB
JPUSHService.h 25KB
BMKRouteSearchType.h 20KB
IFlySpeechConstant.h 19KB
MBProgressHUD.h 17KB
MDCFlexibleHeaderView.h 17KB
UIView+SDAutoLayout.h 16KB
YYDiskCache.h 15KB
MDCCollectionViewEditingDelegate.h 13KB
BMKGeometry.h 13KB
MobClick.h 12KB
YYKVStorage.h 11KB
YYCGUtilities.h 11KB
DQServiceInterface.h 11KB
UIImage+YYWebImage.h 10KB
YYWebImageManager.h 10KB
MDCCollectionViewStyling.h 10KB
YYKitMacro.h 10KB
MDCTextInputController.h 10KB
MDCThumbTrack.h 10KB
MDCTextInputArt.h 10KB
MDFTextAccessibility.h 9KB
UIButton+YYWebImage.h 9KB
MDCButton.h 9KB
MDCPalettes.h 8KB
YYImageCache.h 8KB
DQEnum.h 8KB
DQAPIDefine.h 8KB
UIImageView+YYWebImage.h 8KB
BMKOverlayView.h 8KB
MDCTextInput.h 8KB
YYCache.h 7KB
BMKPoiSearchType.h 7KB
MDCNavigationBar.h 7KB
MDCSlider.h 7KB
MDCInkTouchController.h 7KB
YYMemoryCache.h 7KB
IFlySpeechRecognizer.h 7KB
MDCCollectionViewStylingDelegate.h 7KB
BMKTypes.h 7KB
MDCCollectionInfoBarView.h 6KB
UITableView+SDAutoTableViewCellHeight.h 6KB
MDCTypography.h 6KB
MDCTabBar.h 6KB
IFlyRecognizerView.h 6KB
IFlySpeechUnderstander.h 6KB
MDCFeatureHighlightViewController.h 6KB
MDCAlertController.h 5KB
ZLDefine.h 5KB
MDCButtonBar.h 5KB
MDCMath.h 5KB
MDTextField.h 5KB
IFlySpeechEvent.h 5KB
MDCSnackbarManager.h 5KB
MobClickGameAnalytics.h 5KB
MDCSnackbarMessage.h 5KB
MDMTransition.h 5KB
MDFRTL.h 5KB
MDCActivityIndicator.h 5KB
HPGrowingTextView.h 5KB
IFlyVoiceWakeuper.h 5KB
MDCRTL.h 5KB
ServiceCenterBaseModel.h 5KB
DQDefine.h 4KB
共 2032 条
- 1
- 2
- 3
- 4
- 5
- 6
- 21
资源评论
阿齐Archie
- 粉丝: 1w+
- 资源: 2301
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 卡方数据.sav
- Python实现基于Django框架的二手物品购物网站设计源码+数据库.zip
- 基于Python和Django的二手物品购物网站设计源码+数据库脚本.zip
- 【计算机毕业设计】基于h5的移动网赚项目小程序【源码+lw+部署文档+讲解】
- 【计算机毕业设计】基于ssm-vue的oa系统设计与实现【源码+lw+部署文档+讲解】
- 基于pytorch实现的YOLOV5+SORT的车辆行人目标识别及追踪系统源码.zip
- 【计算机毕业设计】基于servlet+jdbc的在线选房系统设计与实现【源码+lw+部署文档+讲解】
- 投身科技创新,勇担时代先锋.pptx
- 【计算机毕业设计】基于SSM的仿微博系统的设计与实现【源码+lw+部署文档+讲解】
- 使用 Web Components 实现,遵循 Material You 设计规范的 Web 前端组件库
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功