我们如何在iOS中使用LTBouncytextfield库?

时间:2016-07-12 08:53:47

标签: ios swift

您好我是堆栈溢出的新手。您能否告诉我如何使用LTBouncyTextField库为文本字段的右侧占位符设置动画。

我的代码是

class SignUpViewController: UIViewController {

@IBOutlet weak var registrationView: UIView!
@IBOutlet weak var Username: LTBouncyTextField!
@IBOutlet weak var Email: LTBouncyTextField!
@IBOutlet weak var Password: LTBouncyTextField!
@IBOutlet weak var ConformPass: LTBouncyTextField!


override func viewDidLoad() {
    super.viewDidLoad()
    registrationView.layer.borderWidth = 1
    registrationView.layer.borderColor = UIColor.blackColor().CGColor
    Username.abbreviatedPlaceholder = " username"
    Username.alwaysBouncePlaceholder = true
    Email.abbreviatedPlaceholder = "email"
    Email.alwaysBouncePlaceholder = true
    Password.abbreviatedPlaceholder = "password"
    Password.alwaysBouncePlaceholder = true
    ConformPass.abbreviatedPlaceholder = "confirmpass"
    ConformPass.alwaysBouncePlaceholder = true
 }

1 个答案:

答案 0 :(得分:0)

很简单。只需将UITextField+LTBouncyPlaceholder.swift拖放到项目中即可。选择它作为textField的类。添加属性,它应该工作。

enter image description here