Latest0.0.1
Homepagehttps://github.com/wangmyQQ/TRPassField
LicenseMIT
Platformsios 8.0
Authors

密码输入控件(swift)

用途

除了限制输入数字和大小写外,还能将字符串强制转化为大写。
image

如何使用

如果是有安装cocopods的话则在Podfile文件中添加“pod ‘TRPassField’”,没有的话直接下载本项目,并将TRPassField文件下的代码导入自己的项目。

具体代码

1.初始化控件
self.passField = TRPassField.init(frame: CGRect.init(x: 20, y: 100, width: width, height: 50))
self.view.addSubview(self.passField!)
2.是否进入输入密码模式
self.passField?.isSecureTextEntry = true
3.设置键盘类型
self.passField?.keyboardType = .asciiCapable
4.设置字体颜色
self.passField?.textColor = UIColor.black
5.是否只允许输入字母和数字
self.passField?.isNumberAndAsciiOnly = true
6.如果是输入不合法的字符串则触发该方法
self.passField?.inputDisableStringBlock = {
print("输入非法字符")
}
7.是否强制转化为大写
self.passField?.isUppercased = false

Latest podspec

{
    "name": "TRPassField",
    "version": "0.0.1",
    "summary": "u5bc6u7801u8f93u5165u63a7u4ef6",
    "homepage": "https://github.com/wangmyQQ/TRPassField",
    "license": "MIT",
    "authors": {
        "u738bu660eu9633": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/wangmyQQ/TRPassField.git",
        "tag": "0.0.1"
    },
    "source_files": "TRPassField"
}

Pin It on Pinterest

Share This