No content attribute for UITableView in .xib

2020-07-08 08:51发布

问题:

(XCode 4.2, iOS 5)

In order to reuse a tableview (with a navigation bar and edit/add buttons) I created a UITableViewController subclass with it's own .xib. However, when I add a UITableView to my .xib's main view the content attribute (which I want to set to dynamic prototypes) it doesn't show up. It just shows the sample content (California: Brea, Burlingame, ...). When I add a UITableView in my main storyboard the content attribute does show up.

What is the issue?

回答1:

For people trying to solve this, it is impossible to set dynamic prototypes cells in a .xib, or even static cells. No embedded sections or cells are supported in .xib files. If you drag a Table View Controller into a .xib, you'll get an error:

Table views with embedded sections and cells are only supported in storyboard documents

Xcode 6.3.2