Lars
Lars

Reputation: 163

IB - add UIView to UITableViewController?

I like to accomplish an UIToolbar below an UITableView and I wanted to use the UITableViewController because it sets up the data source and delegate and other stuff on its own.

I don't need an UINavigationController as has been proposed in similar topics due to only having 1 view currently and my data is without a hierarchy.

I didn't manage to drag and drop an UIView or UIToolbar to my UITableViewController at any place (scene design area or view hierarchy) in Interface Builder of XCode 4.2.

Thus my question: How to add an UIView to an UITableViewController in Interface Builder?

I did manage to achieve the look I intend to accomplish using an UIViewController with an UITableView and an UIToolbar contained in its UIView.

Would using an UIViewController with an UITableView be much more involved than relying on the UITableViewController?

Thank you for your time!

Upvotes: 1

Views: 759

Answers (1)

Rich86man
Rich86man

Reputation: 6557

I think this is your real question

Would using an UIViewController with an UITableView be much more involved than relying on the UITableViewController?

The answer is no, its not much more work. Just add this to the viewcontrollers' .h

@interface MyViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>

Then in the .h add the datasource and delegate functions( you could just copy and paste the functions your'e currently using in your TableViewController)

NOTE: From Xcode 4.5.1: "Static table views are only valid when embedded in UITableViewController instances."

Upvotes: 4

Related Questions