개린이 이야기
2022년 02월 18일의 이야기
iOS 개린이
2022. 2. 18. 23:36
1. 사용자 피드백을 제공하고 진행 상황 보기로 작업
->정답 버튼을 눌렀을 때 맞았는지, 틀렸는지 확인할 수 있도록 색깔을 변경해준다.
sender.backgroundcolor = UIcolor.green
sender.backgroundcolor = UIcolor.red
->버튼을 눌렀을 때 색깔이 변경되고, 다시 색깔을 되돌리기 위해서 함수 updateUI에
trueButton.backgroundcolor = UIcolor.clear
falseButton..backgroundcolor = UIcolor.clear 를 추가한다.
->색깔이 변경되는 시간이 너무 짧아서 눈으로 볼 수 없기 때문에 타이머를 두고 지연시킨다.
timer.scheduledTimer(timeInterval: 0.2, target:self, selector: #selector(updateUI), userInfo:nil, repeats: false)
@objc func updateUI(){ }
-> 진행률 막대를 설정하기 위해서 함수 updateUI에 추가한다.
progressBar.progress = float(questionNumber+1) / float(quiz.count)