Recall & Review
beginner
What is a UIPickerView used for in iOS development?
A UIPickerView lets users select a value from a list by spinning a wheel-like interface. It's like choosing an option from a rotating menu.
Click to reveal answer
beginner
How does UIDatePicker help users in an app?
UIDatePicker lets users pick dates and times easily using a familiar scrolling wheel or calendar style. It simplifies entering date/time information.
Click to reveal answer
intermediate
Which protocol must a class conform to for providing data to a UIPickerView?The class must conform to <code>UIPickerViewDataSource</code> to provide the number of components and rows, and <code>UIPickerViewDelegate</code> to provide the content and handle selection.Click to reveal answer
intermediate
What property of UIDatePicker controls whether it shows date, time, or both?
The
datePickerMode property controls the display mode. It can be set to .date, .time, or .dateAndTime.Click to reveal answer
intermediate
How can you respond when a user changes the selected value in a UIPickerView?
Implement the delegate method
pickerView(_:didSelectRow:inComponent:). This method is called whenever the user picks a new row.Click to reveal answer
Which method provides the number of rows in a UIPickerView component?
✗ Incorrect
The method pickerView(_:numberOfRowsInComponent:) tells the picker how many rows to show in each component.
What property of UIDatePicker sets it to show only time?
✗ Incorrect
Setting datePickerMode to .time makes the UIDatePicker show only the time selection.
Which delegate method is called when a user selects a new row in UIPickerView?
✗ Incorrect
pickerView(_:didSelectRow:inComponent:) is called when the user changes the selection.
How many components does a basic UIPickerView usually have?
✗ Incorrect
Most simple pickers have one component, like a single spinning wheel.
Which class is used to let users pick dates and times in iOS?
✗ Incorrect
UIDatePicker is the built-in control for selecting dates and times.
Explain how to set up a UIPickerView to show a list of options and respond when the user picks one.
Think about how you tell the picker what to show and how to react when the user spins the wheel.
You got /4 concepts.
Describe how to configure a UIDatePicker to let users pick only a date, and how to get the selected date.
Focus on the mode property and how to listen for changes.
You got /3 concepts.