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
a开发者_运维技巧s 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.
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.
精彩评论