Isfirstresponder swift问题

时间:2016-10-22 20:38:27

标签: ios swift swift3

我得到一个"方法不会覆盖其超类中的任何方法"对于a是第一响应者功能。我在网上看了这个,没有解决方案。你能不能帮我解决这个问题。这是代码。

public override func isFirstResponder() -> Bool {
    // Return true if any of `self`'s subviews is the current first responder.
    // Needs to unwrap the IBOutlets otherwise IBInspectable is crashing when using CardTextField because IBOutlets
    // are not initialized yet when IBInspectable engine runs.
    guard let numberInputTextField = numberInputTextField, let monthTextField = monthTextField, let yearTextField = yearTextField, let cvcTextField = cvcTextField else {
        return false
    }

    return [numberInputTextField, monthTextField, yearTextField, cvcTextField]
        .filter({$0.isFirstResponder})
        .isEmpty == false
}

这是错误的图像

Error of IsFirstResponderError

1 个答案:

答案 0 :(得分:2)

尝试替换它:

public override func isFirstResponder() -> Bool {

用这个:

public override var isFirstResponder: Bool {

Apple doc