A simple iOS app that displays a list of favorite things in a table view.
- Create a UIViewController called FavoriteThingsViewController
- In the AppDelegate didFinishLaunching method initialize a UINavigationController with a scoreViewController instance as the rootViewController
- Make the navigationController the rootViewController of the window.
Note: This is just for the test. We're going to delete this code once we're done
- Add a UIButton and UILabel as properties on the new viewcontroller class
- Initialize and put the button and label on the screen
- Set the button's title to "Press me" for control state normal
- Set the label's text to "Change me"
- Add a function that changes the label's text to "Thanks for changing me"
- Add self as target to the button with the new method as the selector
- Remove the button and label from the view
- Add a UITableView as a property on the viewController class
- Initialize and add the tableView as a subview of the main view
- Create a NSObject subclass called FavoriteThingsTableViewDataSource
- In the header file, adopt the UITableViewDataSource protocol
- Add the required UITableViewDataSource methods to the implementation file
- Write a method that returns an array of strings (these can be your favorite things)
- In numberOfRows return the count of your array method
- in cellForRowAtIndexPath return a cell with the textLabel.text set to the string at indexPath.row from the array method