Interacting with UITableViews

Currently our AlphabetController is the dataSource of the table, but remember how tables also have a delegate? We need to make our controller the delegate if we want it to respond when someone taps the row.

The table view’s dataSource methods are generally about supplying information to a table; the delegate methods concern themselves with what happens after the table is set up and how the user interacts with it. We’ll use one of these delegate methods to push a new view controller when a row is tapped.

We start by making our controller the delegate in viewDidLoad, just like dataSource.

 @table.dataSource = self
»@table.delegate = self

There aren’t ...

Get RubyMotion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.