我有一个UITextField,我想在点击时放大它的宽度.我设置了约束,并确保左边的约束优先级低于我试图在右边设置动画的约束.
这是我尝试使用的代码.
// move the input box
UIView.animateWithDuration(10.5, animations: {
self.nameInputConstraint.constant = 8
}, completion: {
(value: Bool) in
println(">>> move const")
})
Run Code Online (Sandbox Code Playgroud)
这有效,但它似乎只是瞬间发生,似乎没有任何动作.我试着设置它10秒钟以确保我没有遗漏任何东西,但我得到了相同的结果.
nameInputConstraint是我控制拖动以从IB连接到我的类的约束的名称.
感谢您的帮助!