UITableView which is its own Delegate and DataSource

I spent some time tonight working out a simple class which extends UITableView and conforms to its own protocols. If you are just learning about UITableViews they can seem a little daunting, but like so many other pieces in the iPhone toolbox they are very easy to use once you get the hang of it.

If you add a UITableView to your root view it will be a box with some lines across it and you can make them move by touching and dragging in vertical gestures. In order to respond to the touch selections you must set a delegate to the class, just like any other object (Like UIButton or UISwitch). There is a second delegate called "dataSource" which is used to populate the table "cells". The delegate class must conform to UITableViewDelegate and UITableViewDataSource.


  1. Thanks!!!
    I forgot to set the dataSource to self and I couldn't find the problem.



Post a Comment

Popular posts from this blog

XCode4: UITabBarController with UINavigationController using Interface Builder

Taking Stuff Apart: Sony TC-800B Portable Reel-to-Reel Recorder

Easy and accurate SVG to DXF conversion using Inkscape and pstoedit