title: Building a custom UIPickerView
body: <p>I am trying to build a custom <code>UIPickerView</code> replacement class mainly for learning purposes but with a view to implementing this within an application I am developing. I have put a lot of time and effort into the UI of my application and now the default <code>UIPickerView</code> just doesn't fit right.</p>
  
  <p>I saw this <a href="http://dribbble.com/shots/991626-What-time?list=users" rel="nofollow">Dribble</a> mock up of a really slick looking date/time picker but realise that theres not a chance in hell that <code>UIPickerView</code> can be customised this heavily without some major hacking.</p>
  
  <p>After a whole lot of reading and investigation, I have found that <code>UIPickerView</code> uses <code>UITableView</code>s for it's components rather than a plain <code>UIScrollView</code> as I had first assumed. This is confusing for two reasons:</p>
  
  <p>Customising <code>UITableViewCell</code>s is a major pain in the derriere. It's not that it's hard work, just laborious and rarely yields the required result. Somehow <code>UIPickerView</code> manages to pull this off though with very little overhead. I would assume that each row in a component just uses <code>UITableViewCellStyleDefault</code> with a custom view for it's <code>contentView</code> but you know what they say about assumptions.</p>
  
  <p>The second thing that is throwing me off is that <code>UIPickerView</code> conforms to the <code>UITableViewDataSource</code> protocol, but not the <code>UITableViewDelegate</code> protocol. This seems a little odd as the delegate is responsible for providing the correct height via <code>– tableView:heightForRowAtIndexPath:</code> <code>UIPickerView</code> however does allow you to set the size of a component via <code>– pickerView:rowHeightForComponent:</code></p>
  
  <p>In line with this, it also seems a strange choice to utilise a table view as natively these do not "snap" to a specified row the way a scroll view would with <code>pagingEnabled</code>.</p>
  
  <p>Can anyone offer up an explanation of why the default <code>UIPickerView</code> doesn't conform to the aforementioned delegate? Would it be easier for me to implement my custom picker with a <code>UIScrollView</code> instead or should the <code>UITableView</code> provide the functionality required?</p>