{"id":13696244,"url":"https://github.com/czl620/UFKit","last_synced_at":"2025-05-03T16:33:03.612Z","repository":{"id":37549359,"uuid":"198788177","full_name":"czl620/UFKit","owner":"czl620","description":"快速集成表单Form","archived":false,"fork":false,"pushed_at":"2020-10-16T02:08:30.000Z","size":44718,"stargazers_count":267,"open_issues_count":5,"forks_count":51,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-25T15:56:51.848Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/czl620.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-25T08:14:40.000Z","updated_at":"2025-01-08T00:23:08.000Z","dependencies_parsed_at":"2022-07-12T16:22:46.981Z","dependency_job_id":null,"html_url":"https://github.com/czl620/UFKit","commit_stats":null,"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czl620%2FUFKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czl620%2FUFKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czl620%2FUFKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czl620%2FUFKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/czl620","download_url":"https://codeload.github.com/czl620/UFKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252216137,"owners_count":21713103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T18:00:37.660Z","updated_at":"2025-05-03T16:32:58.597Z","avatar_url":"https://github.com/czl620.png","language":"Objective-C","funding_links":[],"categories":["UI Components"],"sub_categories":[],"readme":"```objective-c\n          _ _     _ _   _ _ _ _ _   _ _     _ _    _ _   _ _ _ _ _ _ __\n         /  /    /  /  /  _ _ _ /  /  /   ╱  ╱    /__/  /_ _ _   _ _ _/\n        /  /    /  /  /  /        /  /  ╱  ╱     _ _         /  /\n       /  /    /  /  /  /_ _ _   /  / ╱  ╱      /  /        /  /\n      /  /    /  /  /  _ _ _ /  /  / \\  \\      /  /        /  /\n     /  /_ __/  /  /  /        /  /   \\  \\    /  /        /  /\n     \\ _ _ _ _ /  /__/        /__/     \\__\\  /__/        /__/\n```\n\n### 效果\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830150133864.gif)\n\n\n\n### 要求\n\n- **iOS 8.0 or later**\n\n- **Xcode 11.0 or later**\n\n  \n\n#### 1、表单UFFormView\n\n```objective-c\nUFFormView *formView = [UFFormView makeFormView:^(UFFormViewMaker * _Nonnull make) {\n        // TODO:设置表单样式\n    }];\n```\n\n或\n\n```objective-c\nUFFormView *formView = [[UFFormView alloc] init];\n// TODO:设置表单样式\n```\n\n#### 2、表单样式\n\n##### 1、什么是样式？\n\n样式就是设置UI控件的字体、颜色、对齐方式等一列属性。包括：文本样式UFTextStyle、标题样式UFRowTitleStyle、手机验证码按钮样式UFMobileCodeStyle、单选按钮样式UFRadioGroupStyle、表单组样式UFSectionStyle等。\n\n##### 2、如何创建表单样式？\n\n​\t1、文本样式\n\n```objective-c\nUFTextStyle *textStyle = [UFTextStyle makeTextStyle:^(UFRowTextStyleMaker * _Nonnull make) {\n        make\n        .color([UIColor redColor])            // 设置文本颜色\n        .font([UIFont systemFontOfSize:14])   // 设置文本字体\n        .textAlignment(NSTextAlignmentLeft);  // 设置文本对齐方式\n    }];     \n```\n\n或\n\n```objective-c\nUFTextStyle *textStyle = [[UFTextStyle alloc] init];\ntextStyle.color = [UIColor redColor];           // 设置文本颜色\ntextStyle.font = [UIFont systemFontOfSize:14];  // 设置文本字体\ntextStyle.textAlignment = NSTextAlignmentLeft;  // 设置文本对齐方式\n```\n\n​\t2、标题样式\n\n```objective-c\nUFRowTitleStyle *titleStyle = [UFRowTitleStyle makeTitleStyle:^(UFRowTitleStyleMaker * _Nonnull make) {\n        make\n        .width(90)                           // 设置标题宽度\n        .color([UIColor redColor])           // 设置标题颜色\n        .font([UIFont systemFontOfSize:14])  // 设置标题字体\n        .textAlignment(NSTextAlignmentLeft); // 设置标题对齐方式\n    }];     \n```\n\n或\n\n```objective-c\nUFRowTitleStyle *titleStyle = [[UFTextStyle alloc] init];\ntitleStyle.width = 90;                           // 设置标题宽度\ntitleStyle.color = [UIColor redColor];           // 设置标题颜色\ntitleStyle.font = [UIFont systemFontOfSize:14];  // 设置标题字体\ntitleStyle.textAlignment = NSTextAlignmentLeft;  // 设置标题对齐方式\n```\n\n​\t3、手机验证码样式\n\n```objective-c\nUFMobileCodeStyle *codeStyle = [UFMobileCodeStyle makeMobileCodeStyle:^(UFMobileCodeStyleMaker * _Nonnull make) {\n        make\n        .cornerRadius(10)                           // 设置按钮圆角\n        .backgroundColor([UIColor redColor])        // 设置按钮背景色\n        .separatorColor([UIColor lightGrayColor])   // 设置输入框与按钮之间分割线的颜色\n        .color([UIColor whiteColor])                // 设置按钮标题颜色\n        .font([UIFont systemFontOfSize:14])         // 设置按钮标题字体\n        .textAlignment(NSTextAlignmentLeft);        // 设置按钮标题对齐方式\n    }];\n```\n\n或\n\n```objective-c\nUFMobileCodeStyle *codeStyle = [[UFMobileCodeStyle alloc] init];\ncodeStyle.cornerRadius = 10;                         // 设置按钮圆角     \ncodeStyle.backgroundColor = [UIColor redColor];      // 设置按钮背景色\ncodeStyle.separatorColor = [UIColor lightGrayColor]  // 设置输入框与按钮之间分割线的颜色\ncodeStyle.color = [UIColor whiteColor];              // 设置按钮标题颜色\ncodeStyle.font = [UIFont systemFontOfSize:14];       // 设置按钮标题字体\ncodeStyle.textAlignment = NSTextAlignmentLeft;       // 设置按钮标题对齐方式\n```\n\n​\t4、单选按钮样式\n\n```objective-c\nUFRadioGroupStyle *radioGroupStyle = [UFRadioGroupStyle makeRadioGroupStyle:^(UFRowRadioGroupStyleMaker * _Nonnull make) {\n        make\n        .image([UIImage imageNamed:@\"radio_checked\"])              // 未选中图片\n        .selectedImage([UIImage imageNamed:@\"radio_unchecked\"]);   // 选中图片\n    }];\n```\n\n或\n\n```objective-c\nUFRadioGroupStyle *radioGroupStyle = [[UFRadioGroupStyle alloc] init];\nradioGroupStyle.image = [UIImage imageNamed:@\"radio_checked\"];             // 未选中图片\nradioGroupStyle.selectedImage = [UIImage imageNamed:@\"radio_unchecked\"];   // 选中图片\n```\n\n##### 3、统一添加表单样式\n\n1、添加左侧标题样式\n\n```objective-c\n[UFFormView makeFormView:^(UFFormViewMaker * _Nonnull make) {\n        make\n        .titleStyle([UFRowTitleStyle makeTitleStyle:^(UFRowTitleStyleMaker * _Nonnull make) {                                \n\t// TODO:设置标题样式（参考如何创建标题样式）\n        }]);\n    }];    \n```\n\n或\n\n```objective-c\nUFRowTitleStyle *titleStyle = [[UFRowTitleStyle alloc] init];\n// TODO:设置标题样式（参考如何创建标题样式）\nformView.titleStyle = titleStyle;    \n```\n\n2、设置右侧值样式\n\n```objective-c\nUFFormView *formView = [UFFormView makeFormView:^(UFFormViewMaker * _Nonnull make) {\n            make\n            .valueStyle([UFTextStyle makeTextStyle:^(UFRowTextStyleMaker * _Nonnull make) {\n                // TODO:设置值样式（参考如何创建文本样式）\n            }]);\n     }];    \n```\n\n或\n\n```objective-c\nUFTextStyle *valueStyle = [[UFTextStyle alloc] init];\n// TODO:设置值样式（参考如何创建文本样式）\nformView.valueStyle = valueStyle;   \n```\n\n##### 4、统一设置行高\n\n```objective-c\nUFFormView *formView = [UFFormView makeFormView:^(UFFormViewMaker * _Nonnull make) {\n       make\n       .rowHeight(50);\n   }];\n```\n\n或\n\n```objective-c\nformView.rowHeight = 50;\n```\n\n#### 3、分组UFSection\n\n##### 1、创建分组\n\n```objective-c\nUFSection *section = [UFSection makeSection:^(UFSectionMaker * _Nonnull make) {\n\n    }];\n```\n\n或\n\n```objective-c\n  UFSection *section = [[UFSection alloc] init];\n```\n\n##### 2、设置分组样式\n\n​\t1、统一设置组内的表单样式\n\n```objective-c\nUFSection *section = [UFSection makeSection:^(UFSectionMaker * _Nonnull make) {\n      make\n       // 设置标题样式\n      .titleStyle([UFRowTitleStyle makeTitleStyle:^(UFRowTitleStyleMaker * _Nonnull make) {\t\t\t\t           \t\t\t\t// TODO:设置标题样式（参考如何创建标题样式）  \n         }])\n       // 设置值样式\n       .valueStyle([UFTextStyle makeTextStyle:^(UFRowTextStyleMaker * _Nonnull make) {\n          // TODO:设置值样式（参考如何创建文本样式）    \n       }]);\n    }];    \n```\n\n或\n\n```objective-c\nUFSection *section = [[UFSection alloc] init];\n\n// 设置标题样式\nUFRowTitleStyle *titleStyle = [[UFRowTitleStyle alloc] init];\n// TODO:设置标题样式（参考如何创建标题样式）\nsection.titleStyle = titleStyle;\n\n// 设置值样式\nUFTextStyle *valueStyle = [[UFTextStyle alloc] init];\n// TODO:设置值样式（参考如何创建文本样式）  \nsection.valueStyle = valueStyle;    \n```\n\n​\t2、设置组头、脚样式\n\n```objective-c\n[UFSection makeSection:^(UFSectionMaker * _Nonnull make) {\n      make\n        // 设置头样式\n      .headerStyle([UFSectionStyle makeSectionStyle:^(UFSectionStyleMaker * _Nonnull make) {\n       make\n       .height(30)                         // 设置头高度\n       .text(@\"页眉\")                      // 设置头描述信息\n       .color([UIColor lightGrayColor])    // 设置头描述信息颜色\n       .font([UIFont systemFontOfSize:12]) // 设置头描述信息字体\n       .numberOfLines(0);                  // 设置头描述信息多行\n        }])\n        \n        // 设置脚样式\n      .footerStyle([UFSectionStyle makeSectionStyle:^(UFSectionStyleMaker * _Nonnull make) {\n        make\n       .height(30)                         // 设置脚高度\n       .text(@\"页脚\")                      // 设置脚描述信息\n       .color([UIColor lightGrayColor])    // 设置脚描述信息颜色\n       .font([UIFont systemFontOfSize:12]) // 设置脚描述信息字体\n       .numberOfLines(0);                  // 设置脚描述信息多行\n      }]);            \n     }]; \n```\n\n或\n\n```objective-c\nUFSection *section = [[UFSection alloc] init];\n\n// 设置头样式\nUFSectionStyle *headerStyle = [[UFSectionStyle alloc] init];\nheaderStyle.height = 30;                            // 设置头高度\nheaderStyle.text = @\"页眉\";                         // 设置头描述信息\nheaderStyle.color = [UIColor lightGrayColor];       // 设置头描述信息颜色\nheaderStyle.font = [UIFont systemFontOfSize:12];    // 设置头描述信息字体\nheaderStyle.numberOfLines = 0;                      // 设置头描述信息多行\nsection.headerStyle = headerStyle;\n\n// 设置脚样式\nUFSectionStyle *footerStyle = [[UFSectionStyle alloc] init];\nfooterStyle.height = 30;                            // 设置脚高度\nfooterStyle.text = @\"页脚\";                         // 设置脚描述信息\nfooterStyle.color = [UIColor lightGrayColor];       // 设置脚描述信息颜色\nfooterStyle.font = [UIFont systemFontOfSize:12];    // 设置脚描述信息字体\nfooterStyle.numberOfLines = 0;                      // 设置脚描述信息多行\nsection.footerStyle = footerStyle;\n```\n\n##### 3、添加组到表单\n\n```objective-c\nUFFormView *formView = [UFFormView makeFormView:^(UFFormViewMaker * _Nonnull make) {\n       \t make\n        .addSection([UFSection makeSection:^(UFSectionMaker * _Nonnull make) {\n            // TODO:设置组样式\n        };\n    }];\n```\n\n或\n\n```objective-c\n[formView addSection:section];\t\n```\n\n#### 4、行UFRow\n\n##### 1、子类\n\n```objective-c\nUFRow                                // 文本\nUFSubtitleRow                        // 子标题\nUFTextFieldRow                       // 单行输入\nUFDatePickerRow                      // 日期选择器\nUFPickerViewRow                      // 单项选择器\nUFMultiplePickerViewRow              // 多项选择器\nUFAreaPickerRow                      // 三级地址选择器\nUFCustomPickerViewRow                // 自定义选择器\nUFTextViewRow                        // 多行输入\nUFMobileCodeRow                      // 手机验证码\nUFAvatarRow                          // 头像\nUFRadioGroupRow                      // 单选\nUFSwitchRow                          // 开关\nUFPlateNumberRow                     // 车牌号码    \n```\n\n##### 2、如何创建行？（常规写法不再赘述）\n\n**（1）UFRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145004771.png)\n\n```objective-c\nUFRow *row = [UFRow makeRow:^(UFRowMaker * _Nonnull make) {\n        make\n        .height(50)                                  // 设置行高\n        .image([UIImage imageNamed:@\"icon\"])         // 设置图标\n        .title(@\"姓名\")                               // 设置标题\n        .titleStyle([UFRowTitleStyle makeTitleStyle:^(UFRowTitleStyleMaker * _Nonnull make) {\n            make\n            .width(100)                              // 设置标题宽度，为了对齐表单\n            .color([UIColor blackColor])             // 设置标题颜色\n            .font([UIFont systemFontOfSize:15])      // 设置标题字体\n            .textAlignment(NSTextAlignmentLeft);     // 设置标题对齐方式\n        }])                                          // 设置标题样式\n        .value(@\"陈张利\")                             // 设置默认值\n        .valueStyle([UFTextStyle makeTextStyle:^(UFRowTextStyleMaker * _Nonnull make) {\n            make\n            .color([UIColor blackColor])             // 设置值颜色\n            .font([UIFont systemFontOfSize:15])      // 设置值字体\n            .textAlignment(NSTextAlignmentRight);    // 设置值对齐方式\n        }])                                          // 设置值样式\n        .valueDidChanged(^(__kindof UFRow * _Nonnull row, NSString * _Nonnull value) {\n            // 监听值得变化\n        })\n        .accessoryType(UFRowAccessoryDisclosureIndicator) // 设置行后的附件样式，如箭头、对号\n        .accessoryImage([UIImage imageNamed:@\"arrow\"])    // 自定义行后的附件图片，如箭头、对号\n        .rowDidSelected(^(__kindof UFRow * _Nonnull row) {\n            // 点击行事件\n        })\n        .name(@\"name\");                                   // 行的名称,可看做时字段的key，唯一值\n    }];\n```\n\n***注***：为使行的右端对齐，你可使用**UFRowAccessorySpace**进行占位。\n\n**（2）UFSubtitleRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145022643.png)\n\n```objective-c\nUFSubtitleRow *subtitleRow = [UFSubtitleRow makeSubtitleRow:^(UFSubtitleRowMaker * _Nonnull make) {\n       make\n       .subtitle(@\"推荐支付宝用户使用\")                      // 设置子标题\n       .subtitleStyle([UFRowTitleStyle makeTitleStyle:^(UFRowTitleStyleMaker * _Nonnull make) {\n           make\n           .width(140)                                    // 设置子标题宽度\n           .font([UIFont systemFontOfSize:12])            // 设置子标题字体\n           .color([UIColor lightGrayColor]);              // 设置子标题颜色\n       }])                                                // 设置子标题样式\n       .accessoryImage([UIImage imageNamed:@\"checked\"])   // 自定义行后的附件图片\n       .height(80)                                        // 设置行高\n       .image([UIImage imageNamed:@\"alipay\"])             // 设置图标\n       .title(@\"支付宝\")                                  // 设置标题\n       .name(@\"pay\");                                 \n  \n       // 其他属性不再赘述，参考UFRow设置\n  \n   }];\n```\n\n**（3）UFAvatarRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/2019083014503593.png)\n\n```objective-c\nUFAvatarRow *avatarRow = [UFAvatarRow makeAvatarRow:^(UFAvatarRowMaker * _Nonnull make) {\n        make\n        .cornerRadius(30)                                   // 设置头像圆角，圆角大小决定行高\n        .avatarImage([UIImage imageNamed:@\"touxiang\"])      // 设置默认头像，网络图像不设置或加载失败时，可作为占位头像\n        .avatarDidSelected(^(__kindof UFAvatarRow * _Nonnull row, UIImageView * _Nonnull avatarView) {\n            // 点击头像事件\n        })\n        .title(@\"头像\")\n        .value(@\"http://img0.imgtn.bdimg.com/it/u=2572957358,1108684168\u0026fm=26\u0026gp=0.jpg\") // 设置网络图片\n        .accessoryType(UFRowAccessorySpace)\n        .name(@\"avatar\");\n\n        // 其他属性不再赘述，参考UFRow设置\n    }];\n```\n\n***注***：**UFKit**提供了**UIViewControlle**的选择图片的方法\n\n```objective-c\n[self ufk_pickerImageForResult:^(UIImage * _Nonnull image) {\n\t\n}];\n```\n\n**（4）UFRadioGroupRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145143477.png)\n\n```objective-c\n UFRadioGroupRow *radioGroupRow  = [UFRadioGroupRow makeRadioGroupRow:^(UFRadioGroupRowMaker * _Nonnull make) {\n        make\n        .itemArray(@[@\"男\",@\"女\"])      // 设置选项\n        .editable(YES)                 // 是否允许编辑\n        .radioGroupStyle([UFRadioGroupStyle makeRadioGroupStyle:^(UFRowRadioGroupStyleMaker * _Nonnull make) {\n            make\n            .image([UIImage imageNamed:@\"rg_unchecked\"])          // 设置默认未选中图片\n            .selectedImage([UIImage imageNamed:@\"rg_checked\"]);   // 设置选中图片\n        }])\n        .title(@\"性别\")\n        .value(@\"男\")\n        .accessoryType(UFRowAccessorySpace)\n        .name(@\"gender\");\n   \n   \t// 其他属性不再赘述，参考UFRow设置\n    }];\n```\n\n**（5）UFTextFieldRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145203625.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTQ3MzAyNDU=,size_16,color_FFFFFF,t_70)\n\n```objective-c\nUFTextFieldRow *textFieldRow = [UFTextFieldRow makeTextFieldRow:^(UFTextFieldRowMaker * _Nonnull make) {\n        make\n        .limitType(UFInputLimitTypeMobile)    // 设置输入限制\n        .editable(YES)                        // 是否允许编辑\n        .maxLength(11)                        // 设置最大输入长度，设置limitType后该属性可能会不起作用\n        .keyboardType(UIKeyboardTypeDefault)  // 设置键盘样式，设置limitType后该属性可能会不起作用\n        .secureTextEntry(NO)                  // 是否安全输入\n        .canPerformAction(YES)                // 是否允许粘贴复制\n        .placeholder(@\"请输入\")                // 占位字符，不设置时自动会添加请输入title\n        .barTintColor([UIColor blackColor])   // 键盘上方取消/确定的颜色\n        .title(@\"联系方式\")\n        .accessoryType(UFRowAccessorySpace)\n        .name(@\"mobile\");\n  \n  \t// 其他属性不再赘述，参考UFRow设置\n    }];\n```\n\n***注：*** **UFKit**提供了以下输入限制样式，以便限制输入框内输入的内容。\n\n```objective-c\ntypedef NS_ENUM(NSUInteger, UFInputLimitType) {\n    UFInputLimitTypeNone = 0,        // 无限制\n    UFInputLimitTypeMobile,          // 手机号码\n    UFInputLimitTypeEmail,           // 邮箱\n    UFInputLimitTypeIdCard,          // 身份证号\n    UFInputLimitTypeNumbers,         // 数字\n    UFInputLimitTypeLetters,         // 字母\n    UFInputLimitTypeCapitalLetters,  // 大写字母\n    UFInputLimitTypeAlphanumeric,    // 字母和数字\n    UFInputLimitTypeFloat,           // 浮点数\n    UFInputLimitTypeMoney,           // 金额（2位小数）\n};\n```\n\n**（5）UFMobileCodeRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145220756.png)\n\n```objective-c\nUFMobileCodeRow *mobileCodeRow = [UFMobileCodeRow makeCodeRow:^(UFCodeRowMaker * _Nonnull make) {\n            make\n            .codeStyle([UFMobileCodeStyle makeMobileCodeStyle:^(UFMobileCodeStyleMaker * _Nonnull make) {\n                make\n                .backgroundColor([UIColor whiteColor])     // 设置按钮背景色\n                .cornerRadius(5)                           // 设置按钮圆角\n                .separatorColor([UIColor lightGrayColor]); // 设置输入框与按钮之间分割线的颜色\n                // 其他属性不再赘述，参考UFRowTextStyleMaker设置\n            }])\n            .codeDidClicked(^(__kindof UFMobileCodeRow * _Nonnull row, UIButton * _Nonnull button) {\n               //点击获取验证码事件\n            })\n            .maxLength(4)\n            .limitType(UFInputLimitTypeNumbers)\n            .title(@\"验证码\")\n            .accessoryType(UFRowAccessorySpace)\n            .name(@\"code\");\n\n            // 其他属性不再赘述，参考UFTextFieldRow设置\n        }];\n```\n\n***注***：**UFKit**提供了**UIButton**的倒计时方法\n\n```objective-c\n[button ufk_countDown:60]; // 60s倒计时\n```\n\n**（6）UFPickerViewRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145244893.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTQ3MzAyNDU=,size_16,color_FFFFFF,t_70)\n\n```objective-c\n UFPickerViewRow *pickerViewRow = [UFPickerViewRow makePickerViewRow:^(UFPickerViewRowMaker * _Nonnull make) {\n            make\n            .itemArray(@[@\"总经办\",@\"行政部\",@\"人力资源部\",@\"财务部\",@\"产品部\",@\"技术部\",@\"运营部\"]) // 设置选项\n            .title(@\"部门\")\n            .value(@\"技术部\")\n            .accessoryType(UFRowAccessoryDisclosureIndicator)\n            .name(@\"org\");\n\n            // 其他属性不再赘述，参考UFTextFieldRow设置\n        }];   \n```\n\n**（7）UFAreaPickerRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145302242.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTQ3MzAyNDU=,size_16,color_FFFFFF,t_70)\n\n```objective-c\nUFAreaPickerRow *areaPickerRow = [UFAreaPickerRow makeAreaPickerRow:^(UFAreaPickerRowMaker * _Nonnull make) {\n            make\n            .areaSeparator(@\",\")     // 省市区之间的分割字符\n            .title(@\"地址\")\n            .accessoryType(UFRowAccessoryDisclosureIndicator)\n            .name(@\"address\");\n\n            // 其他属性不再赘述，参考UFPickerViewRow设置\n        }];\n```\n\n**（8）UFCustomPickerViewRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145322425.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTQ3MzAyNDU=,size_16,color_FFFFFF,t_70)\n\n```objective-c\nUFCustomPickerViewRow *customPickerRow = [UFCustomPickerViewRow makeCustomPickerViewRow:^(UFCustomPickerViewRowMaker * _Nonnull make) {\n              make.\n              delegate(weakSelf)   // 设置代理\n              .valueDidSelected(^(__kindof UFCustomPickerViewRow * _Nonnull row, UITextField * _Nonnull textField) {\n                  // 选择结束后的确定事件\n              })\n              .title(@\"选择器\")\n              .name(@\"custom\")\n              .accessoryType(UFRowAccessoryDisclosureIndicator);;\n          }];      \n```\n\n​\tUFCustomPickerViewRowDelegate\n\n```objective-c\n// 列数\n- (NSInteger)numberOfComponentsInPickerViewRow:(UFCustomPickerViewRow *)pickerViewRow;\n// 每列的行数\n- (NSInteger)pickerViewRow:(UFCustomPickerViewRow *)pickerViewRow numberOfRowsInComponent:(NSInteger)component;\n// 行标题\n- (NSString *)pickerViewRow:(UFCustomPickerViewRow *)pickerViewRow titleForRow:(NSInteger)row forComponent:(NSInteger)component;\n// 选中行\n- (void)pickerViewRow:(UFCustomPickerViewRow *)pickerViewRow didSelectRow:(NSInteger)row inComponent:(NSInteger)component;    \n```\n\n**（9）UFMultiplePickerViewRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145343479.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTQ3MzAyNDU=,size_16,color_FFFFFF,t_70)\n\n```objective-c\nUFMultiplePickerViewRow *multiplePickerViewRow = [UFMultiplePickerViewRow makeMultiplePickerViewRow:^(UFMultiplePickerViewRowMaker * _Nonnull make) {\n        make\n        .itemArray(@[@\"看电影\",@\"旅游\",@\"看书\",@\"打游戏\",@\"篮球\",@\"足球\",@\"其他\"])  // 设置选项\n        .title(@\"爱好\")\n        .value(@\"打游戏,其他\")\n        .accessoryType(UFRowAccessoryDisclosureIndicator)\n        .name(@\"hobby\");\n\n        // 其他属性不再赘述，参考UFTextFieldRow设置\n    }];\n```\n\n**（10）UFDatePickerRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145359629.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTQ3MzAyNDU=,size_16,color_FFFFFF,t_70)\n\n```objective-c\nUFDatePickerRow *datePickerRow = [UFDatePickerRow makeDatePickerRow:^(UFDatePickerRowMaker * _Nonnull make) {\n            make\n            .minimumDate(最小时间)                    // 最小时间\n            .maximumDate(最大时间)                    // 最大时间\n            .datePickerMode(UIDatePickerModeDate)    // 时间选择样式\n            .dateFormat(@\"yyyy-MM-dd\")               // 时间格式\n            .title(@\"生日\")\n            .value(@\"2016-12-12\")\n            .accessoryType(UFRowAccessoryDisclosureIndicator)\n            .name(@\"birthday\");\n\n            // 其他属性不再赘述，参考UFTextFieldRow设置\n        }];\n```\n\n**（11）UFPlateNumberRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145417135.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTQ3MzAyNDU=,size_16,color_FFFFFF,t_70)\n\n```objective-c\n UFPlateNumberRow *plateNumberRow = [UFPlateNumberRow makePlateNumberRow:^(UFPlateNumberRowMaker * _Nonnull make) {\n            make\n            .title(@\"车牌号\")\n            .value(@\"鲁A12345\")\n            .accessoryType(UFRowAccessorySpace)\n            .name(@\"plate\");\n\n            // 其他属性不再赘述，参考UFTextFieldRow设置\n        }];  \n```\n\n**（12）UFTextViewRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/2019083014550629.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTQ3MzAyNDU=,size_16,color_FFFFFF,t_70)\n\n```objective-c\nUFTextViewRow *textViewRow = [UFTextViewRow makeTextViewRow:^(UFTextViewRowMaker * _Nonnull make) {\n            make\n            .title(@\"个人简介\")\n            .value(@\"苹果公司是美国一家高科技公司。由史蒂夫·乔布斯、斯蒂夫·沃兹尼亚克和罗·韦恩等人于1976年4月1日创立，总部位于加利福尼亚州的库比蒂诺\")\n            .accessoryType(UFRowAccessorySpace)\n            .name(@\"introduction\");\n        }];   \n```\n\n**（13）UFSwitchRow**\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145532511.png)\n\n```objective-c\nUFSwitchRow *switchRow = [UFSwitchRow makeSwitchRow:^(UFSwitchRowMaker * _Nonnull make) {\n          make\n          .tintColor([UIColor redColor])     // 设置开关颜色\n          .title(@\"免打扰\")\n          .value(SWITCH_ON)\n          .accessoryType(UFRowAccessorySpace)\n          .valueDidChanged(^(__kindof UFRow * _Nonnull row, NSString * _Nonnull value) {\n              // 开关事件\n          })\n          .name(@\"allow\");\n      }];\n```\n\n***注***：**UFKit**提供了 ***SWITCH_ON*** （开）和 ***SWITCH_OFF*** （关）的常量定义\n\n##### 3、如何自定义行\n\n1、继承UFRow创建其子类\n\n2、继承UFRowCell创建其子类\n\n3、注册Row和cell到formView\n\n```objective-c\nUFFormView *formView = [UFFormView makeFormView:^(UFFormViewMaker * _Nonnull make) {\n            make\n            .registerRow([CustomRow class], [CustomRowCell class])；\n            }];\n```\n##### 4、如何查找行？\n```objective-c\n\n// 根据名称查找\nUFRow *row = [formView findRowByName:@\"name\"];\n\n// 根据位置查找，如第1组第4行\nUFRow *row = [formView findRowInRange:UFMakeRange(0, 3)];\n```\n\n##### 5、添加行到组\n\n```objective-c\nUFSection *section = [UFSection makeSection:^(UFSectionMaker * _Nonnull make) {\n        make\n        .addRow(/*你定义的行*/);\n}];\n```\n\n```objective-c\n UFSection *section = [UFSection makeSection:^(UFSectionMaker * _Nonnull make) {\n                    make\n                    .addRowWithBlock(^__kindof UFRow * _Nonnull{\n                        // 你定义的行\n                        UFRow *row = [[UFRow alloc] init];\n                        return row;\n                    });\n            }];\n```\n\n#### 5、提交\n\n1、添加提交按钮\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145557132.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTQ3MzAyNDU=,size_16,color_FFFFFF,t_70)\n\n![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830145608161.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTQ3MzAyNDU=,size_16,color_FFFFFF,t_70)\n\n```objective-c\nUFActionButton *submitButton = [UFActionButton makeActionButton:^(UFActionButtonMaker * _Nonnull make) {\n            make\n            .titleForState(@\"提交\", UIControlStateNormal)\n            .titleColorForState([UIColor whiteColor], UIControlStateNormal)\n            .cornerRadius(22)\n            .backgroundColor([UIColor redColor])\n            .actionButtonClick(^(UFActionButton * _Nonnull button) {\n                // 点击提交事件\n            });\n        }];\n```\n\n```objective-c\n[UFFormView makeFormView:^(UFFormViewMaker * _Nonnull make) {\n            make\n            .addSubmitButton(submitButton)\n            .addCancelButton(cancelButton);\n    }];\n```\n\n2、获取表单数据\n\n```objective\n[formView toDictionary];\n```\n\n#### 6、依赖\n\n'Masonry', '~\u003e 1.1.0'  \n\n'SDWebImage', '~\u003e 5.0.6'  \n\n'IQKeyboardManager', '~\u003e 6.3.0'\n\n#### 7、安装\n\npod 'UFKit'\n\n#### 8、联系方式\nQQ:893419255（请注明UFKit）\n\n\n\n---\n\n版本记录：\n\n- ###### 1.1.17  \n\n   支持国际化（简体中文、繁体中文、英文）\n\n- ###### 1.2.0  \n   支持自适应高度、暗黑模式\n\n### 要饭\n![在这里插入图片描述](https://upload-images.jianshu.io/upload_images/793623-f494e1e8a78a51e7.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/600)\n![在这里插入图片描述](https://upload-images.jianshu.io/upload_images/793623-df95ef369c4db26b.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/600)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fczl620%2FUFKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fczl620%2FUFKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fczl620%2FUFKit/lists"}