Isfirstresponder swift问题

我得到一个“方法不会覆盖任何方法从它的超类”的第一个响应函数。我在网上查了这些,没有解决办法。你能帮我解决这个问题吗?这是代码。Isfirstresponder swift问题

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

回答:

尝试更换此:

public override func isFirstResponder() -> Bool { 

与此:

public override var isFirstResponder: Bool { 

Apple doc

以上是 Isfirstresponder swift问题 的全部内容, 来源链接: utcz.com/qa/258365.html

回到顶部