【问题标题】:removing keyboard with swift快速删除键盘
【发布时间】:2015-11-14 00:33:04
【问题描述】:

我想在完成输入后通过单击框外的任何位置来移除键盘,所以我写了这个

 override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent!) {
        self.view.endEditing(true)
    }

但它说我没有覆盖晚餐类的任何方法。但是怎么办?:)

【问题讨论】:

标签: ios swift keyboard


【解决方案1】:

对于 Swift 2,使用:

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-28
    • 1970-01-01
    • 1970-01-01
    • 2014-02-19
    • 1970-01-01
    • 1970-01-01
    • 2020-01-27
    • 1970-01-01
    相关资源
    最近更新 更多