Giter VIP home page Giter VIP logo

gyeasyform's Introduction

GYEasyForm

CI Status Version License Platform

Overview

GYEasyForm is a library that makes it easy to build forms on the mobile side. GYEasyForm is a simple version of Eureka, written in Objective-C

How to use

    GYEasyForm *form = [[GYEasyForm alloc] init];
    GYEasySection *section = [[GYEasySection alloc] initWithHeaderHeight:10
                                                           headerBgColor:[UIColor groupTableViewBackgroundColor]
                                                            footerHeight:0
                                                           footerBgColor:nil];
    GYNormalTitleRow *row1 = [GYNormalTitleRow rowInit:^(__kindof GYNormalTitleRow * _Nonnull row) {
        row.title = @"first line";
    }];
    GYNormalTitleRow *row2 = [GYNormalTitleRow rowInit:^(__kindof GYNormalTitleRow * _Nonnull row) {
        row.title = @"second line";
    }];
    GYNormalTitleRow *row3 = [GYNormalTitleRow rowInit:^(__kindof GYNormalTitleRow * _Nonnull row) {
        row.title = @"third line";
    }];
    GYNormalTitleRow *row4 = [GYNormalTitleRow rowInit:^(__kindof GYNormalTitleRow * _Nonnull row) {
        row.title = @"fourth line";
    }];
    
    [section appendRows:@[row1, row2, row3, row4]];
    [form appendSection:section];
    self.formView.form = form;

How to customize a row

You need to inherit GYEasyRow to write your own Row and create a Cell corresponding to this Row. like this:

//ZGCustomRow.h
#import <GYEasyForm/EasyForm.h>
@interface ZGCustomRowCell : GYEasyCell

@end

@interface ZGCustomRow : GYEasyRow<ZGCustomRowCell *>

@end
//ZGCustomRow.m
#import "ZGCustomRow.h"

@implementation ZGCustomRowCell

// You can create controls and layouts here
- (void)prepare { 
    [super prepare];
}

// Changes in variables in row, need to be updated here, 
// Executed after the [row updateCell] method
- (void)update { 
    [super update];
}

@end

@implementation ZGCustomRow

// Specify the cell associated with the row
- (Class)associatedCellClass { return [ZGCustomRowCell class]; }

@end

Of course, it can also be created with xcode template files. There is a Templates folder in the project directory. You can go to this folder to execute sh install.sh, Then restart xcode. You can create a row 👇👇

template_row

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

iOS 8.0+

Installation

GYEasyForm is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'GYEasyForm'

Author

gaoyu, [email protected]

License

GYEasyForm is available under the MIT license. See the LICENSE file for more info.

gyeasyform's People

Contributors

gaoyuexit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gyeasyform's Issues

封装表单的一些建议

刚刚看了您的GYEasyForm,关于表单的封装,确实不错,用着挺方便,但是还没有用到项目中,有几个疑问问下,1.表单的展示没问题,但是表单的信息上传这块没有展示,使上传更加方便,不用开发者一个字段一个字段接收和上传,建议把表单的key ,code也封装进去,这样可能会更方便,2.还有例如一些表单的校验,怎么一个个做判断呢 例如手机号 身份证号,数字这些校验,应该怎么判断呢,有点疑惑,3.表单的回显,从后台的接口中获取数据,回显在表单上面,这块该怎么展示呢,希望作者可以在demo中做个示例

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.