반응형
timeInterval에 원하는 시간(초), #selector에 반복할 함수를 입력한다.
Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(testFunc), userInfo: nil, repeats: true)
반복할 함수를 작성한다.
@objc func testFunc(){
print("반복한다.")
}
반응형
'iOS' 카테고리의 다른 글
[iOS] 오류 해결: whose view is not in the window hierarchy! (0) | 2021.03.02 |
---|---|
iOS14에서 UIDatePicker 오류를 해결하자. 'NSInvalidArgumentException', reason: '-[_UIDatePickerIOSCompactView setHighlightsToday:] (0) | 2021.02.22 |
[iOS] iOS 앱 별점(평점) 구현하기 - Cosmos View (1) | 2021.01.19 |
[iOS] 여러개의 View를 한 번에 정렬하기, UIStackView (0) | 2021.01.04 |
[iOS] Swift를 통한 알림창 구현, UIAlertController와 UIAlertAction (0) | 2021.01.03 |
댓글