So, last night we had a great time once again, taking our arrays and displaying them in table views.
When all was said and done, the result looked like this:
Here is the process we followed:
- Start a New Project in XCode (View Based Application for iPhone)
- Declare our variables and outlets in the view controller header file.
- Create properties in the header file for out outlets and variables. (So that we can access them in the implementation file.)
- Synthesize our properties in the implementation file. (To let us use them in the implementation file.)
- Open Interface Builder and add a TableView to our app.
- Link our outlets to the new TableView.
- Close IB and return to Xcode.
- In the header file, set up our view controller as the delegate and datasource for our TableView.
- In the implementation file, initialize our array and put some names in it.
- Add the methods to control the TableView.
- Configure the TableView with 1 section and as many rows as there are elements in our array.
- Tell each cell to show us the corresponding name in our array.
And we’re done!
So, with just those steps, could YOU reproduce the result that we see in the image above?
You can download the iTable Source Code and take a look yourself.
I’ll be posting detailed instructions for each step soon.