Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The UIPickerView is nothing more than a UIView with one or more UITableViews and background and selector views.</p> <p>Hiding and adding views to the UIPicker view might break your code in the future when Apple decides to implement it in another way.</p> <p>It might be a better idea to implement your control with UITableView(s) and your own custom background and selector views.</p> <p>Some tips to implement the UIPickerView behaviour on the UITableView(s):</p> <ul> <li><p>Use the ContentInset to make sure the first/last row is shown in the middle when scrolled to top/bottom.</p></li> <li><p>On the UITableViewSource implement tableView:didSelectRowAtIndexPath: and call scrollToRowAtIndexPath on the UITableView to show the selected row in the middle.</p></li> <li><p>On the UITableViewSource implement scrollViewDidEndDecelerating and scrollViewDidEndDragging (where willDecelerate is false). Detect the row closest to the middle, set that row to selected and scroll that row to the middle with selectRowAtIndexPath on the UITableView (or scrollToRowAtIndexPath when the row was already selected).</p></li> <li><p>In selectRowAtIndexPath and scrollToRowAtIndexPath set atScrollPosition to <strong><em>TOP</em></strong>. This is a little confusing, because the row is shown in the middle, but the ContentInset pushed the top to the middle of the view.</p></li> <li><p>You can detect the row closest to the middle on the UITableView with the frames of the visibleCells and the contentOffset. The NSIndexPath of the row can be found by applying the same index to indexPathsForVisibleRows.</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload