LDK
LDK

Reputation: 2575

Adding a UITableView to DetailView of SplitView

I have created a custom UITableView and I want to add it to the DetailView (which is just a UIView). The default UISplitView of Xcode 4 inserts a toolbar in the DetailView. When I add my custom UITableView it overlaps the toolbar.

This is in my DetailViewController, in the "configureView" method that Xcode adds by default:

[self.view addSubview:booksFromOpenLibraryController.view];

Question 1: is that the best method to add my table view - I'm guessing no, since it then adds the tableView each time a user selects something in the RootView - but where should I place it?

Question 2: How to I avoid having the tableView overlap with the UIToolbar in the UIView?

Upvotes: 0

Views: 1837

Answers (1)

codelark
codelark

Reputation: 12334

If you want to add the TableView once, you can add it in the viewDidLoad method.

In the configureView method, you can update the tableview's data appropriately to reflect whatever changes are dependent on the root view's selection.

To not have the tableview overlap the toolbar, you need to set the frame and autoresizemask of the tableview appropriately to account for any other views in the detail pane.

Upvotes: 1

Related Questions