Latest 1.0.1
Homepage https://github.com/SarielTang/SRTextField
License MIT
Platforms ios , requires ARC
Authors
  • TextField, which can automatically perform regular verification, and automatically prohibits the non – allowed characters to be entered.
  • 能够自动自动禁止字符输入,并进行正则验证的TextField。

Requirements

  • iOS 6.0+

Installation

CocoaPods

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To integrate SRTextField into your Xcode project using CocoaPods, specify it in your Podfile:

platform :ios, '6.0'
use_frameworks!

pod 'SRTextField'

Then, run the following command:

$ pod install

You should open the {Project}.xcworkspace instead of the {Project}.xcodeproj after you installed anything from CocoaPods.

For more information about how to use CocoaPods, I suggest this tutorial.

如何使用SRTextField

  • cocoapods导入:pod 'SRTextField'
  • 手动导入:
    • SRTextField/Classes文件夹中的所有文件拽入项目中
    • 导入主头文件:#import "SRTextField.h"

Usage

  • Create SRTextField, and set the properties you need.
  • 创建SRTextField,并设置你需要的属性
    SRTextField *phoneTextField = [[SRTextField alloc]init];
    phoneTextField.regString = RegStringPhoneNumber;//正则验证是否为手机号码
    phoneTextField.inputType = SRTextFieldInputTypeNumber;//只允许输入数字
    phoneTextField.errorDescription = @"手机号格式错误!";//错误描述
    phoneTextField.emptyDescription = @"手机号不能为空!";//是否为空描述
  • Check a single SRTextField or multiple SRTextField objects, using this method.
  • 检查单个的SRTextField或者多个SRTextField对象,均使用这个方法。
    [SRTextChecker checkAllWidgets:@[t1] completionBlock:^(SRTextCheckerResultInfo *resultInfo) {
        //输出上面填写过的错误提示
        NSLog(@"%@",resultInfo.resultString);
    }];

Latest podspec

{
    "name": "SRTextField",
    "version": "1.0.1",
    "summary": "u80fdu591fu81eau52a8u8fdbu884cu5404u79cdu6b63u5219u9a8cu8bc1u7684TextField",
    "description": "TextField, which can automatically perform regular verification, and automatically prohibits the non - allowed characters to be entered.nttu80fdu591fu81eau52a8u81eau52a8u7981u6b62u5b57u7b26u8f93u5165uff0cu5e76u8fdbu884cu6b63u5219u9a8cu8bc1u7684TextFieldu3002nn#                   * Think: Why did you write this? What is the focus? What does it do?n#                   * CocoaPods will be using this to generate tags, and improve search results.n#                   * Try to keep it short, snappy and to the point.n#                   * Finally, don't worry about the indent, CocoaPods strips it!",
    "homepage": "https://github.com/SarielTang/SRTextField",
    "license": "MIT",
    "authors": {
        "SarielTang": "[email protected]"
    },
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/SarielTang/SRTextField.git",
        "tag": "1.0.1"
    },
    "source_files": [
        "Classes",
        "Classes/**/*.{h,m}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This