Skip to content

SamUncle/WLUnitField

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WLUnitField

https://github.com/zhwayne/WLUnitField

WLUnitField是一个密码/验证码输入框,它提供了一个优雅简洁的输入框🙂,你可以像使用UITextField一样去使用WLUnitField

使用

WLUnitField的使用非常简单。它继承自UIControl,你可以给它添加以下 3 种UIControlEvent

  • UIControlEventEditingDidBegin
  • UIControlEventEditingChanged
  • UIControlEventEditingDidEnd

其他一些非必须的 event 已被忽略。

使用示例:

- (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

About

源码在https://github.com/zhwayne/WLUnitField 这里,本次对源码进行了稍微的改动

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published