2016-10-22 94 views
1

我得到一個「方法不會覆蓋任何方法從它的超類」的第一個響應函數。我在網上查了這些,沒有解決辦法。你能幫我解決這個問題嗎?這是代碼。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

回答

2

嘗試更換此:

public override func isFirstResponder() -> Bool { 

與此:

public override var isFirstResponder: Bool { 

Apple doc