本文共 1248 字,大约阅读时间需要 4 分钟。
OCMaskedTextField
Simple class to display dynamically masked textFields
这是一个简单的类,用来动态的给textFields设置输入文本的特殊限制.
Usage
To use OCMaskedTextFieldView, simply initialize the view with the desired format/mask string.
为了使用OCMaskedTextFieldView,你可以初始化view的时候给定一个输入模板.
OCMaskedTextFieldView *textField = [[OCMaskedTextFieldView alloc] initWithFrame:CGRectMake(20, 94, 280, 33) andMask:@"TR - #### #### #### #### #### ####" showMask:YES];
Default mask supports 3 character sets and is expandable. Hardcoded values are also supported on the masks.
默认的mask支持3种风格.当然也支持复杂的风格哦。
//Default special mask characters:'#' : Numeric Values'&' : Alphanumeric Values'?' : Letter Values
Sample Mask Strings,
作为mask用的字符串,
//IBAN: @"TR - #### #### #### #### #### ####"//Phone Number: @"+90 (###) ### ## ##"//Serial Number: @"[&&&&]-[&&&&]-[&&&&]-[&&&&]"// Name: @"Mr/Mrs. ?????????????"
Blank values can also be set manually for each speacial character. (default is "_")
当然,空格键值可以手动设置成其他特殊字符。
[textField setNumericBlank:@" " alphanumericBlank:@" " letterBlank:@" "];[textField showMask];
License
Licensed under the Apache License, Version 2.0 See Details:
转载地址:http://iizua.baihongyu.com/