Search code examples
uipickerviewswift2xcode7

UIPickerView Wrap Around Swift 2


I need help creating an UIPickerView to wrap around the options. So instead of the picker looking like this:

right now

I want it to look like this (without the "min"):

what I want

I looked everywhere, but I can't find a way to do it with Swift 2.0 Thanks!


Solution

  • 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