본문 바로가기
개린이 이야기

2022년 02월 11일의 이야기

by iOS 개린이 2022. 2. 11.

1. 사전 도전 솔루션 

-eggTimes 사전안에 타이머 시계들을 출력하기 위해서 IBAction 버튼 코드 내에 print(eggTimes[hardness]를 작성한다. 

 

2. egg timer 도전 해결방법.

 

3. 진행률 보기 

-라이브러리에서 progress bar를 timer view 안에 추가한다. 

-> add new contraints에서 왼쪽 오른쪽을 0으로 제약 추가, 수직으로 중심이 되도록 제약 추가한다.

-> 특성검사기에서 스타일을 bar로 변경, 높이를 5로 맞춘다. 

-> 색깔을 노란색, 회색으로 변경한다.

-> IBOulet progressBar로 연결한다. 

-> counter 변수를 지우고, var totalTime = 0, var secondsPassed = 0을 추가한다. 

-> IBAction의 괄호 내에 counter변수가 들어갔던 곳에 totalTime을 넣는다.

-> 함수 updateTimer의 조건문을

    if secondsPassed < totalTime {

         let percentageProgress =  secondsPassed / totalTime   //백분율 

         progressBar.progress = Float(percentageProgress)

         secondsPassed += 1

    }  로 변경한다.

 

4. 우리의 응용 프로그램을 디버깅하는 5단계 접근방식을 사용하여

1) what did you expect your code to do? 

2) what happened instead? 

3) what does your expectation depend upon? 

4) how can we test the things our expectations depend on?

5) fix our code to make reality match expectations

 

 

 

 

 

 

 

'개린이 이야기' 카테고리의 다른 글

2022년 02월 18일의 이야기  (0) 2022.02.18
2022년 2월 16일의 이야기  (0) 2022.02.16
2022년 02월 10일의 이야기  (0) 2022.02.10
2022년 02월 09일의 이야기  (0) 2022.02.09
2022년 02월 08일의 이야기  (0) 2022.02.08