日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

一个iOS表单框架-UFKit

發布時間:2023/12/2 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 一个iOS表单框架-UFKit 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

效果:

使用:

pod 'UFKit'- (void)viewDidLoad {[super viewDidLoad];__block UFFormView *formView = [UFFormView makeFormView:^(UFFormViewMaker * _Nonnull make) {make.addSection([UFSection makeSection:^(UFSectionMaker * _Nonnull make) {make.addRow([UFAvatarRow makeAvatarRow:^(UFAvatarRowMaker * _Nonnull make) {make.cornerRadius(30).avatarImage([UIImage imageNamed:@"touxiang"]).avatarDidSelected(^(__kindof UFAvatarRow * _Nonnull row, UIImageView * _Nonnull avatarView) {NSLog(@"你點擊了頭像");}).title(@"頭像").value(@"http://img0.imgtn.bdimg.com/it/u=2572957358,1108684168&fm=26&gp=0.jpg").name(@"avatar").accessoryType(UFRowAccessorySpace);}]).addRow([UFTextFieldRow makeTextFieldRow:^(UFTextFieldRowMaker * _Nonnull make) {make.title(@"姓名").value(@"蘋果").name(@"name").accessoryType(UFRowAccessorySpace);}]).addRow([UFRadioGroupRow makeRadioGroupRow:^(UFRadioGroupRowMaker * _Nonnull make) {make.itemArray(@[@"男",@"女"]).title(@"性別").value(@"男").name(@"gender").accessoryType(UFRowAccessorySpace);}]).addRow([UFTextFieldRow makeTextFieldRow:^(UFTextFieldRowMaker * _Nonnull make) {make.maxLength(11).regex(@"^[1][3-9]*$").keyboardType(UIKeyboardTypeNumberPad).title(@"聯系方式").name(@"mobile").accessoryType(UFRowAccessorySpace);}]).addRow([UFMobileCodeRow makeCodeRow:^(UFCodeRowMaker * _Nonnull make) {make.codeStyle([UFMobileCodeStyle makeMobileCodeStyle:^(UFMobileCodeStyleMaker * _Nonnull make) {}]).codeDidClicked(^(__kindof UFMobileCodeRow * _Nonnull row, UIButton * _Nonnull button) {NSLog(@"點了了獲取驗證碼");}).maxLength(4).keyboardType(UIKeyboardTypeNumberPad).title(@"驗證碼").name(@"code").accessoryType(UFRowAccessorySpace);}]).addRow([UFPickerViewRow makePickerViewRow:^(UFPickerViewRowMaker * _Nonnull make) {make.itemArray(@[@"iOS",@"macOS",@"swift",@"iPhone",@"iPad",@"iPod"]).title(@"技能").value(@"iOS").name(@"skills").accessoryType(UFRowAccessoryDisclosureIndicator);}]).addRow([UFMultiplePickerViewRow makeMultiplePickerViewRow:^(UFMultiplePickerViewRowMaker * _Nonnull make) {make.itemArray(@[@"看電影",@"旅游",@"看書",@"打游戲",@"籃球",@"足球",@"其他"]).title(@"愛好").value(@"打游戲,其他").name(@"hobby").accessoryType(UFRowAccessoryDisclosureIndicator);}]).addRow([UFDatePickerRow makeDatePickerRow:^(UFDatePickerRowMaker * _Nonnull make) {make.datePickerMode(UIDatePickerModeDate).dateFormat(@"yyyy-MM-dd").title(@"生日").name(@"birthday").accessoryType(UFRowAccessoryDisclosureIndicator);}]).addRow([UFSwitchRow makeSwitchRow:^(UFSwitchRowMaker * _Nonnull make) {make.tintColor([UIColor redColor]).title(@"免打擾").value(SWITCH_ON).name(@"allow").accessoryType(UFRowAccessorySpace).valueDidChanged(^(__kindof UFRow * _Nonnull row, __kindof NSString * _Nonnull value) {if ([row.value boolValue]) {NSLog(@"開");} else {NSLog(@"關");}});}]).addRow([UFPlateNumberRow makePlateNumberRow:^(UFPlateNumberRowMaker * _Nonnull make) {make.title(@"車牌號").value(@"魯A123456").name(@"plate").accessoryType(UFRowAccessorySpace);}]).addRow([UFTextViewRow makeTextViewRow:^(UFTextViewRowMaker * _Nonnull make) {make.maxLength(120).title(@"個人簡介").value(@"蘋果公司是美國一家高科技公司。由史蒂夫·喬布斯、斯蒂夫·沃茲尼亞克和羅·韋恩等人于1976年4月1日創立,總部位于加利福尼亞州的庫比蒂諾").name(@"introduction").accessoryType(UFRowAccessorySpace);}]);}]).addSubmitButton([UFActionButton makeActionButton:^(UFActionButtonMaker * _Nonnull make) {make.titleForState(@"提交", UIControlStateNormal).titleColorForState([UIColor whiteColor], UIControlStateNormal).cornerRadius(17).backgroundColor([UIColor redColor]).actionButtonClick(^(UFActionButton * _Nonnull button) {NSLog(@"提交的信息:\n%@",[formView toDictionary]);});}]).addToSuperView(self.view);}];[formView mas_makeConstraints:^(MASConstraintMaker *make) {make.edges.mas_equalTo(self.view);}]; }復制代碼

依賴:

'Masonry', '~> 1.1.0'

'SDWebImage', '~> 5.0.6'

'IQKeyboardManager', '~> 6.3.0'

github

轉載于:https://juejin.im/post/5d39753b518825634532565d

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的一个iOS表单框架-UFKit的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。