0
I 클래스가 있습니다스위프트 3 타이머
class GameManager {...
을 그 안에서 나는이 FUNC 있습니다
func startGame() {
msgTimer = Timer(timeInterval: 0.5, target: self, selector: #selector(typeMessage(_:)), userInfo: nil, repeats: true)
}
하고 호출하는 선택 :
@objc func typeMessage(_ sender:Timer) {
if textCount > strInitText.characters.count {
let strThisChar = strInitText[strInitText.index(strInitText.startIndex, offsetBy: textCount)]
strDisplayText = strDisplayText + String(strThisChar)
print(strDisplayText)
}
}
을
하지만 선택기가 호출되지 않습니다. 이 발사하기 전에 : -
에 변경? –
내 viewcontroller에서, 이것은 VMMV 패턴의 viewcontroller 모델입니다. - startGame이 호출됩니다. 거기에 중단 점을 넣을 수 있습니다. – PruitIgoe
왜 @objc입니까? 또한 필요하지 않은 경우 objc 제거를 시도 할 수 있습니다. -> msgTimer = Timer (timeInterval : 0.5, target : self, selector : #selector (self. typeMessage), userInfo : nil, repeats : true) – Ishika