import UIKit
class ViewController: UIViewController {
@IBOutlet weak var shakingLb: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func motionBegan(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
self.shakingLb.isHidden = false
}
override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
DispatchQueue.main.asyncAfter(deadline:.now() + 1.0) {
self.shakingLb.isHidden = true
}
}
override func becomeFirstResponder() -> Bool {
return true
}
}
08-28
724
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交