Spring
Spring

Reputation: 11855

Changing rootviews view type in an iOS app

While creating a navigation based application, it automatically creates a root view controller which subclasses UITableViewController, but in MainWindow.xib as you know I can't see a UITableView is placed under root view controller but we drag and drop a table view there. Can we simply drag and drop a UIView instead of a UITableView and change the root view controller class to sublass a uiview instead of UITableView and change its methods?

Or I must drag a UITableView in IB for the root view controller? I am a beginner and I do not want to make complicated things so what is the simplest way of using a UIView as a root. If thats not simple I will stick with the table view.

Upvotes: 0

Views: 466

Answers (1)

Rahul Vyas
Rahul Vyas

Reputation: 28730

Yes you can change. You just need to change some bindings in inteface builder and change rootViewController's superclass to UIViewController instead of UITableViewController.

UPDATE

First open the rootViewController.xib and delete the tableiew from there and drag-n-drop a UIView. Bind that View to view property in file-owner. Change superclass of rootViewController from UITableViewController to UIViewController. That's it.

Here are the screenshots.

enter image description here

enter image description here

enter image description here

enter image description here

Upvotes: 1

Related Questions