I followed the "Storyboard tutorial" and made some Table View Controllers; now I want to change one of them to a regular View Controller.
Is there a way to do that without making a new one?
A TableView is just that a TableView (subclass of UIView). It can be added to a ViewController and resized, used alongside another view based object, etc.
Start a segue from any object that implements an action method, such as a control or gesture recognizer. You may also start segues from table rows and collection view cells. Right-click the control or object in your current view controller. Drag the cursor to the view controller you want to present.
The view renders presentation of the model in a particular format. The controller responds to the user input and performs interactions on the data model objects. The controller receives the input, optionally validates it and then passes the input to the model.
One option is to edit the storyboard file directly. Navigate to the Storyboard in Finder and open with any text editor. Find the view controller in question and change the node in the xml from tableViewController
to viewController
.
This saves the pain of having to recreate the view controller, which comes in handy when you have a lot of connections made. This also works the other way around. If you have a viewController that started out as a plain view controller but you want to turn it into a table view controller you can simply edit the file reversing the node.
You need to create a new view controller and drag a tableview into it. Remember to set the delegate and datasource of the tableview to the view controller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With