Mam problem, gdy buduję moją aplikację w szybkim 2. Xcode mówi:Swift: Błąd: 'wymagana' inicjator 'init (koder :)' muszą być dostarczone przez podklasy 'UIView'
'required' initializer 'init(coder:)' must be provided by subclass of 'UIView'
jest to kod klasy:
class creerQuestionnaire: UIView {
@IBOutlet weak var nomQuestionnaire: UITextField!
@IBOutlet weak var question: UITextField!
@IBOutlet weak var reponse: UITextField!
var QR: Questionnaire
@IBAction func creerQuestion(sender: AnyObject) {
QR.ajouterQuestion(question.text!, nouvReponse: reponse.text!)
}
}
i jest to klasa Kwestionariusz:
import Foundation
class Questionnaire {
var QR = [String(), String()]
func getQuestion(nbQuestion: Int) ->String {
return QR[nbQuestion]
}
func getReponse(nbReponse: Int) ->String {
return QR[nbReponse]
}
func ajouterQuestion(nouvQuestion: String, nouvReponse: String) {
QR += [nouvQuestion, nouvReponse]
}
}
Merci!
dlaczego jest jednym 'override' i inne "wymagane"? –
@MichaelDautermann Właśnie dodałem trochę informacji o wymaganych i nadpisaniach. Dzięki za atrakcję. – Allen
Dzięki za odpowiedź! –