项目作者: shien7654321

项目描述 :
A textfield that can limit the length of the text.
高级语言: Objective-C
项目地址: git://github.com/shien7654321/STLimitTextField.git
创建时间: 2017-05-16T07:52:32Z
项目社区:https://github.com/shien7654321/STLimitTextField

开源协议:MIT License

下载


STLimitTextField

Language
Platform
Version
License

A textfield that can limit the length of the text.

STLimitTextField is a textfield that can limit the length of the text. You can limit the length of the text or the length of the character.

STLimitTextFieldPreview01

Requirements

  • iOS 8.0 or later (For iOS 8.0 before, maybe it can work, but I have not tested.)
  • ARC

Installation

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

  1. pod 'STLimitTextField'

Usage

Import headers in your source files

In the source files where you need to use the library, import the header file:

  1. #import <STLimitTextField/STLimitTextField.h>

Initialize STLimitTextField

STLimitTextField is a subclass of UITextFiled. You can initialize it like UITextField, of course you can also use storyboard:

  1. STLimitTextField *textFiled = [[STLimitTextField alloc] init];

Configure STLimitTextFiled

STLimitTextFiled has two ways to limit the length of the text. You can use STLimitLength to limit the length of the text, or use STLimitChar to limit the length of the text characters:

  1. textFiled.limitType = STLimitLength;

STLimitTextFiled can set the limit length with code or storyboard:

  1. textFiled.limit = 5;

STLimitTextFieldPreview02

Author

Suta, shien7654321@163.com

License

MIT license.