Skip to content

Instantly share code, notes, and snippets.

@joelmoss
Created May 7, 2012 18:26
Show Gist options
  • Select an option

  • Save joelmoss/2629474 to your computer and use it in GitHub Desktop.

Select an option

Save joelmoss/2629474 to your computer and use it in GitHub Desktop.
UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame UIScreen.mainScreen.bounds
@window.rootViewController = ContactsController.alloc.init
@window.makeKeyAndVisible
true
end
end
class ContactsController < UITableViewController
def tableView(tableView, numberOfRowsInSection:section)
3
end
def tableView(tableView, celForRowAtIndexPath:indexPath)
cell = UITableViewCell.alloc.initWithStyle UITableViewCellStyleDefault, reuseIdentifier:nil
cell.textLabel.text = 'stuff!'
cell
end
end
@rspeicher
Copy link

def tableView(tableView, celForRowAtIndexPath:indexPath) -- missing the second l in "cell"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment