Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert UITableViewController to UIViewController in xcode 4.2

I need to convert uitableviewcontroller to uiviewcontroller. It's not a problem in < xcode 4.2.

Normally I just need to change the .h (header file) to :UIViewController and in IB, remove the connected UITableView outlet and connect the new UIView to view outlet.

In Xcode 4.2, I cannot remove the connected UITableView. It's gray out. Is it imposible to convert uitableviewcontroller to uiviewcontroller in xcode 4.2?

like image 992
moon Avatar asked Nov 04 '11 20:11

moon


2 Answers

Create a new ViewController in storyboard.

Click and drag the tableView from UITableViewController to the new viewcontroller.

Now add the four border constraints to the tableview in the viewcontroller(zero at each sides). Now delete the old tableviewcontroller. That's it.

Also change the superclass in the h file to UIViewController. But you will lose all your segues from and to the previous tableViewController.

like image 112
abhimuralidharan Avatar answered Jan 03 '23 11:01

abhimuralidharan


Try:

  • Create a new ViewController
  • Add a TableView to the root view of new ViewController
  • Copy the TableView from the original ViewController
  • Select the fresh TableView in your new ViewController
  • Paste ViewController

You can then delete the fresh, unused TableView

like image 23
MikeNatty Avatar answered Jan 03 '23 13:01

MikeNatty