【发布时间】:2015-03-15 05:45:53
【问题描述】:
我试图弄清楚当用户将文本字段留空时如何使文本字段在按钮按下时抖动。
我目前正在运行以下代码:
if self.subTotalAmountData.text == "" {
let alertController = UIAlertController(title: "Title", message:
"What is the Sub-Total!", preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Okay", style: UIAlertActionStyle.Default,handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
} else {
}
但我认为将文本字段摇动作为警报会更具吸引力。
我找不到任何东西来为文本字段设置动画。
有什么想法吗?
谢谢!
【问题讨论】:
-
你做了什么来尝试为文本字段设置动画?
-
我不知道从哪里开始。对我来说没有任何意义,而且我找不到任何教程,即使是我可以采用的最轻微的变化。我已经尝试过 animateWithDuration UIViewAnimationOptions.Transition 但代码总是错误地说明我如何理解它。
-
Google for iPhone 动画教程。 Ray Wanderlich 的文章通常很好读。
-
谢谢,我会尽力阅读并理解!
标签: ios swift uitextfield