0
0
iOS Swiftmobile~10 mins

Slider in iOS Swift - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a slider with a minimum value of 0.

iOS Swift
let slider = UISlider()
slider.minimumValue = [1]
Drag options to blanks, or click blank then click option'
A0
B1
C-1
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Setting minimumValue to a value higher than maximumValue.
Using a negative number when only positive values are expected.
2fill in blank
medium

Complete the code to set the slider's maximum value to 50.

iOS Swift
let slider = UISlider()
slider.maximumValue = [1]
Drag options to blanks, or click blank then click option'
A0
B50
C100
D-50
Attempts:
3 left
💡 Hint
Common Mistakes
Setting maximumValue lower than minimumValue.
Using negative numbers for maximumValue.
3fill in blank
hard

Fix the error in the code to set the slider's current value to 25.

iOS Swift
let slider = UISlider()
slider.value = [1]
Drag options to blanks, or click blank then click option'
Anil
B"25"
Cslider.maximumValue
D25
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around numbers, making them strings.
Assigning nil to a non-optional property.
4fill in blank
hard

Fill both blanks to create a slider with a minimum value of 10 and a maximum value of 100.

iOS Swift
let slider = UISlider()
slider.minimumValue = [1]
slider.maximumValue = [2]
Drag options to blanks, or click blank then click option'
A10
B0
C100
D50
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping minimum and maximum values.
Setting minimum higher than maximum.
5fill in blank
hard

Fill all three blanks to create a slider, set its range from 0 to 200, and set its initial value to 75.

iOS Swift
let slider = UISlider()
slider.minimumValue = [1]
slider.maximumValue = [2]
slider.value = [3]
Drag options to blanks, or click blank then click option'
A0
B200
C75
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Setting initial value outside the min-max range.
Confusing maximum and initial values.