Search code examples
iosuitableviewxcode5

Can't even get a UITableView to show


I'm starting to learn to program and I'm already getting a really annoying problem. When I follow, step by step, the Apple Developer guide "Start Developing iOS Apps Today" and I add a UITableViewController (even if it's the only view controller in the project) and I set it as the initial ViewController, I run the app to check if it works and I can't get the table view to show, all I see is a blank static background.

It doesn't matter what kind of cell I use, the table view doesn't appear.

What am I doing wrong?

Xcode 5.1, target: iOS 7.1


Solution

  • How to get UItableView to show

    • Drag a UITableViewController to the storyboard
    • Give your prototype cell an Identifier (e.g "cell")
    • Create a Objective-C class file that inherits from the UITableViewController Class.
    • Assign that class to the ViewController you dragged
    • Return at least one section
    • Return at least one row per section
    • Set a text for the cell in cellAtRowIndex

    I created a DEMO PROJECT for you, see how I did things over there.