Acerbic Resonance

There’s no substitute for a good subtitle.

UITableView Hints

As someone only recently exposed to Objective-C, Cocoa, and the iPhone development environments, I have been struggling with some of the ways that Apple has decided to do things.

Today I beat my head against a UITableView for most of the day, trying to figure out how to set up the view, the datasource, the delegate, and make them all work together.

I came home from work a bit dejected as I was unable to make my UITableView do what I wanted all day – specifically, I wanted to be able to have more than one category, and have more than one item in each category. All I was good at doing was making it go crashy crashy when trying to add the second category.

This evening I ran across this article that had just the tip I needed: I was missing a method in my datasource that would tell the view how many categories it would have. I spent considerable time today working under the assumption that the UITableView would tell the datasource and delegate what it had/wanted, but it appears that Apple likes to Think Different™ from me.

In any case, I have my sections working now, and wanted to put a link to where I found the answer here just in case I forgot next week when I need it again.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *