XLForm 表單提交

XLForm 據(jù)說這個(gè)庫特別屌,前幾天項(xiàng)目需求大量的表單提交類似下圖的表單有15 個(gè)頁面。。。


2596697-e68549805c3552c0.png

開始上代碼....

1.導(dǎo)入
#import "XLForm.h"
2.繼承
@interface LSXMessageSetupVC : XLFormViewController
3.創(chuàng)建
-(void)initializeForm{
    
    // 初始化form 順便帶個(gè)title
    XLFormDescriptor * formDescriptor = [XLFormDescriptor formDescriptorWithTitle:@"消息提醒"];
    // 表單Section對(duì)象
    XLFormSectionDescriptor * section;
    // 表單Row對(duì)象
    XLFormRowDescriptor * row;
    
    /***********第一個(gè)section****************/
    section = [XLFormSectionDescriptor formSection];
    [formDescriptor addFormSection:section];
    
    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"ISsound" rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"播放聲音"];
    if([[USER_DEFAULT valueForKey:@"issound"] isEqualToString:@"yes"]){
        row.value=@"YES";
    }else{
        row.value=@"NO";
    }
    [section addFormRow:row];
    
    /***********第二個(gè)section****************/
    section = [XLFormSectionDescriptor formSection];
    [formDescriptor addFormSection:section];
    
    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"ISshock" rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"手機(jī)震動(dòng)"];
    if([[USER_DEFAULT valueForKey:@"Isshock"] isEqualToString:@"yes"]){
        row.value=@"YES";
    }else{
        row.value=@"NO";
    }
    [section addFormRow:row];
    
    self.form=formDescriptor;
    
}
//設(shè)置每行row的高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        return 20;
    }
    return CGFLOAT_MIN;
}
//獲取每行的value值
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue  {
         NSLog(@"%@",newValue);
}
//特別提醒:
rowType的類型有好多,可以根據(jù)自己的需求選擇
//文本
NSString *const XLFormRowDescriptorTypeText = @"text";
NSString *const XLFormRowDescriptorTypeName = @"name";
NSString *const XLFormRowDescriptorTypeURL = @"url";
NSString *const XLFormRowDescriptorTypeEmail = @"email";
NSString *const XLFormRowDescriptorTypePassword = @"password";
NSString *const XLFormRowDescriptorTypeNumber = @"number";
NSString *const XLFormRowDescriptorTypePhone = @"phone";
NSString *const XLFormRowDescriptorTypeTwitter = @"twitter";
//解釋
NSString *const XLFormRowDescriptorTypeAccount = @"account";
NSString *const XLFormRowDescriptorTypeInteger = @"integer";
NSString *const XLFormRowDescriptorTypeImage = @"image";
//十進(jìn)制的
NSString *const XLFormRowDescriptorTypeDecimal = @"decimal";
//textView
NSString *const XLFormRowDescriptorTypeTextView = @"textView";
//郵政編碼
NSString *const XLFormRowDescriptorTypeZipCode = @"zipCode";
//push
NSString *const XLFormRowDescriptorTypeSelectorPush = @"selectorPush";
//ipod(使用)
NSString *const XLFormRowDescriptorTypeSelectorPopover = @"selectorPopover";
//sheet
NSString *const XLFormRowDescriptorTypeSelectorActionSheet = @"selectorActionSheet";
//AlertView
NSString *const XLFormRowDescriptorTypeSelectorAlertView = @"selectorAlertView";
//pick
NSString *const XLFormRowDescriptorTypeSelectorPickerView = @"selectorPickerView";
//cell insert
NSString *const XLFormRowDescriptorTypeSelectorPickerViewInline = @"selectorPickerViewInline";
//多選(push 返回的是array)(語言)(以及返回item count)
NSString *const XLFormRowDescriptorTypeMultipleSelector = @"multipleSelector";
//ipod(使用)
NSString *const XLFormRowDescriptorTypeMultipleSelectorPopover = @"multipleSelectorPopover";
//一行雙選
NSString *const XLFormRowDescriptorTypeSelectorLeftRight = @"selectorLeftRight";
NSString *const XLFormRowDescriptorTypeSelectorSegmentedControl = @"selectorSegmentedControl";
NSString *const XLFormRowDescriptorTypeDateInline = @"dateInline";
NSString *const XLFormRowDescriptorTypeDateTimeInline = @"datetimeInline";
NSString *const XLFormRowDescriptorTypeTimeInline = @"timeInline";
NSString *const XLFormRowDescriptorTypeCountDownTimerInline = @"countDownTimerInline";
NSString *const XLFormRowDescriptorTypeDate = @"date";
NSString *const XLFormRowDescriptorTypeDateTime = @"datetime";
NSString *const XLFormRowDescriptorTypeTime = @"time";
NSString *const XLFormRowDescriptorTypeCountDownTimer = @"countDownTimer";
NSString *const XLFormRowDescriptorTypeDatePicker = @"datePicker";
NSString *const XLFormRowDescriptorTypePicker = @"picker";
NSString *const XLFormRowDescriptorTypeSlider = @"slider";
NSString *const XLFormRowDescriptorTypeBooleanCheck = @"booleanCheck";
NSString *const XLFormRowDescriptorTypeBooleanSwitch = @"booleanSwitch";
NSString *const XLFormRowDescriptorTypeButton = @"button";
NSString *const XLFormRowDescriptorTypeInfo = @"info";
NSString *const XLFormRowDescriptorTypeStepCounter = @"stepCounter";

--------end--------

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Android 自定義View的各種姿勢(shì)1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 178,954評(píng)論 25 709
  • 發(fā)現(xiàn) 關(guān)注 消息 iOS 第三方庫、插件、知名博客總結(jié) 作者大灰狼的小綿羊哥哥關(guān)注 2017.06.26 09:4...
    肇東周閱讀 15,199評(píng)論 4 61
  • ¥開啟¥ 【iAPP實(shí)現(xiàn)進(jìn)入界面執(zhí)行逐一顯】 〖2017-08-25 15:22:14〗 《//首先開一個(gè)線程,因...
    小菜c閱讀 7,322評(píng)論 0 17
  • 《艾倫日記本》——每天一篇原創(chuàng)日記或干貨!歡迎關(guān)注,精彩不容錯(cuò)過! 艾倫|原創(chuàng)寫手,多棲于設(shè)計(jì)、攝影、策劃、培訓(xùn)和...
    艾倫教練閱讀 479評(píng)論 0 1
  • “不要輸在起跑線上”,是現(xiàn)在很多家長不停的掛在嘴邊的一句話,不僅這樣說,這樣想了,也這樣做了。 看到其他的孩子學(xué)習(xí)...
    大杜915閱讀 323評(píng)論 0 2

友情鏈接更多精彩內(nèi)容