Let's make a slot machine!
UIPickerViewDataSource
. Check out the docs on it...it should look pretty familiar to UITableView
. Implement the required methods on your view controller. There should be three components (i.e., columns), and each component should have one row per symbol in the slot machine.UIPickerViewDelegate
to put in the appropriate text in each row. Each component (column) should have the same stuff in it.
selectRow:inComponent:animated:
to randomly spin each component to a row.UIAlertController
that says whether you won (i.e., all three components have the same value) or lost. There should be two buttons: Cancel
and Spin Again
. These should do reasonable things.View Pickin' Fruit on Learn.co and start learning to code for free.