Conveniently convert a View Controller object to Table View Controller during design time (Storyboard) Conveniently convert a View Controller object to Table View Controller during design time (Storyboard) xcode xcode

Conveniently convert a View Controller object to Table View Controller during design time (Storyboard)


As far as I know there is no UI in Xcode which lets you do this. You can however open the storyboard file in the xml editor (activating the version editor will do that) and change the name of the node from <viewController ...> to <tableViewController ...>. Don't forget to also change the closing tag to </tableViewController>.


What I did, is creating a UITableViewController in IB, open the Storyboard with a text editor, and copy all the nodes inside from the UIViewController to the UITableViewController.

I think that with this way there's less risk of deleting something important.

Before copying the sections objects, make sure that both tableviews (UIViewController and UITableViewController) have the same properties set like: static or dynamic cells, style (plain or grouped), etc.


In Xcode, open the 'Utilities' pane (it appears from the right), click the 'Identity Inspector' and then in the 'Custom Class' region, select a different class. Note, however, this won't change the view in the linked-to controller. You'd need to remove the view and add a UITableView. Might then have to establish some delegate connections.

I've done what you describe multiple times. Sometimes I delete the target and start again; sometimes I do as I describe and convert 'by-hand.'