Welcome, this is a thread for collaboration, questions, and feedback on Part 7 of the iOS Apprentice Email course.
"Plain English" Challenge Solution
I came up with something like this:
- If the slider’s value is greater than the target value, then the difference is: slider value minus the target value.
- However, if the target value is greater than the slider value, then the difference is: target value minus the slider value.
- Otherwise, both values must be equal, and the difference is zero.
This will always lead to a difference that is a positive number, because you always subtract the smaller number from the larger one.
Do the math:
If the slider is at position 60 and the target value is 40, then onscreen the slider is to the right of the target value, and the difference is 60 - 40 = 20.
However, if the slider is at position 10 and the target is 30, then the slider is to the left of the target and has a smaller value. The difference here is 30 - 10 = also 20.
Here’s a download for the project to use at the beginning of this email:
BullsEye-part6-final-v2.zip (29.2 KB)
Here’s a download for the project where it stands at the end of this email:
BullsEye-part7-final-v2.zip (29.1 KB)