Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhwayne/WLUnitField
一种验证码输入 UI 控件
https://github.com/zhwayne/WLUnitField
Last synced: about 1 month ago
JSON representation
一种验证码输入 UI 控件
- Host: GitHub
- URL: https://github.com/zhwayne/WLUnitField
- Owner: zhwayne
- License: mit
- Created: 2016-11-23T10:27:09.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-07T09:15:26.000Z (over 1 year ago)
- Last Synced: 2024-08-03T18:20:57.508Z (4 months ago)
- Language: Objective-C
- Homepage:
- Size: 6.5 MB
- Stars: 250
- Watchers: 7
- Forks: 32
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- Awesome-iOS - WLUnitField - 一种验证码输入 UI 控件 (UI Components)
README
# 简介(Introduction)
这是一个优雅简洁的密码/验证码输入框,你可以像使用`UITextField`一样去使用`WLUnitField`。
This is an elegant and concise password/verification code text field. You can use `WLUnitField` just like `UITextField`.![](./demo.gif)
# 功能特点(Features)
- 支持自动布局(Auto layout supports)
- 提供两种界面面样式:边框和下划线(Provide two UI styles: border-based and underline-based)
- 支持自动填充验证码,仅限 iOS 12 系统(Autofill One time code supports, only for iOS 12+)# 使用方式(Usage)
`WLUnitField`的使用非常简单。它继承自`UIControl`,你可以给它添加以下 3 种`UIControlEvents`:
`WLUnitField` is very sample to use. You use the following 3 kinds of `UIControlEvents`:* UIControlEventEditingDidBegin
* UIControlEventEditingChanged
* UIControlEventEditingDidEnd> 其他一些非必须的 event 已被忽略。
> Some other non-essential events have been ignored.使用示例(Case):
``` Objective-C
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
WLUnitField *uniField = [[WLUnitField alloc] initWithInputUnitCount:4];
uniField.frame = CGRectMake(40, 40, 240, 1);
uniField.delegate = self;
uniField.unitSpace = 12;
uniField.borderRadius = 4;
[uniField sizeToFit];
[uniField addTarget:self action:@selector(unitFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
[self.view addSubview:uniField];
}- (IBAction)unitFieldEditingChanged:(WLUnitField *)sender {
NSLog(@"%s, %@", __FUNCTION__, sender.text);
}
```# License
MIT License