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.

Comments

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

    :D

    ReplyDelete

Post a Comment

Popular posts from this blog

Decommissioning the cloud: A self-hosted future

Using a JFileChooser to browse AWS S3

Taking Stuff Apart: Realistic Modulette-8