开发者

Adding a UITableView to DetailView of SplitView

开发者 https://www.devze.com 2023-04-04 01:34 出处:网络
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 UITabl

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:books开发者_运维技巧FromOpenLibraryController.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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消