I am trying to create a UITableView view (I guess a subview) inside another controller’s view. Essentially here is the (simplified) structure I want for the Settings page I am designing:
- SettingsViewController.h – contains standard property and method definitions.
- SettingsViewController.m – controls the loading and saving of settings.
- SettingsViewController.xib – the parent view for everything going on inside
- 3x UISegmentedControls – each one will control a different setting. They will take up about half of the screen – the top half.
- 1x UITableView – covers the rest of the screen and is scrollable. Scrolling shouldn’t make the other controls disappear.
I tried adding a UITableView object to my .XIB file, then creating outlets for it inside the SettingsViewController.h file, but that didn’t quite work. The table showed, but only in its default format – none of the DataSource methods worked.
I got rid of the code (temporarily), but if you need specifics, I should be able to reproduce it quickly and offer you some. Plus, I might do it right this time…
P.S. Using UITableView is not mandatory. If there is another handy way of displaying and editing a list of items (NSStrings really), I’d be fine with it.
if your tableView is empty and the dataSource methods are correctly implemented you probably just forgot to connect your tableView to the dataSource/delegate.
control-drag from the tableView to the viewController and set dataSource and delegate.