菜鸟教程小白 发表于 2022-12-11 16:57:49

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


                                            <p><p>您好,我是 <strong>堆栈溢出</strong> 的新手。你能告诉我如何使用<a href="https://github.com/lexrus/LTBouncyPlaceholder" rel="noreferrer noopener nofollow"><code>LTBouncyTextField</code></a>用于为文本字段的正确占位符设置动画的库。</p>

<p>我的代码是</p>

<pre><code>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 = &#34; username&#34;
    Username.alwaysBouncePlaceholder = true
    Email.abbreviatedPlaceholder = &#34;email&#34;
    Email.alwaysBouncePlaceholder = true
    Password.abbreviatedPlaceholder = &#34;password&#34;
    Password.alwaysBouncePlaceholder = true
    ConformPass.abbreviatedPlaceholder = &#34;confirmpass&#34;
    ConformPass.alwaysBouncePlaceholder = true
}
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>这很简单。只需将 <code>UITextField+LTBouncyPlaceholder.swift</code> 拖放到您的项目中。选择它作为<code>textField</code> 的类。添加属性,它应该可以工作。 </p>

<p> <a href="/image/9Ba2M.png" rel="noreferrer noopener nofollow"><img src="/image/9Ba2M.png" alt="enter image description here"/></a> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 我们如何在 iOS 中使用 LTBouncytextfield 库?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/38324130/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/38324130/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 我们如何在 iOS 中使用 LTBouncytextfield 库?