I need help creating an UIPickerView to wrap around the options. So instead of the picker looking like this:
I want it to look like this (without the "min"):
I looked everywhere, but I can't find a way to do it with Swift 2.0 Thanks!
I need help creating an UIPickerView to wrap around the options. So instead of the picker looking like this:
I want it to look like this (without the "min"):
I looked everywhere, but I can't find a way to do it with Swift 2.0 Thanks!
Here is an explanation that makes for quicker use:
Goal:
Make your UIPickerView larger than the user will ever try to scroll
Steps:
(1) Extend your picker in size
func pickerView(numberOfRowsInComponent) -> Int {
return 10_000;
}
(2) Access by Modulus
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return data[row%data.count];
}
(3) Init to Middle (after init)
picker.selectRow((10_000/2), inComponent: 0, animated: false);
You can return a very large number in
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int
and select the middle row while initialzing with
selectRow(COUNT/2, inComponent: 0, animated: true)
See this code sample