开发者

How to create multiple table view in a View Controller for iPad?

开发者 https://www.devze.com 2023-01-19 07:34 出处:网络
I am working with the universal apps. Now i want to create a three table views in my view controller for iPAD. I have three separate view controllers with XIB.So how can i add the other two table view

I am working with the universal apps. Now i want to create a three table views in my view controller for iPAD. I have three separate view controllers with XIB.So how can i add the other two table view as subview in the main controllers. Please give me some sample applications and links. In my applica开发者_如何学Pythontion, i have three view controllers and add a subview as table view(not UITableViewController). On clicks the first table view data, it navigates to the second table and clicks the second table view data, it navigates to the third table view.

 Hierarchy:

   MainViewController:
     --SubTableView1 
     --SubTableView2 

See the image below,

How to create multiple table view in a View Controller for iPad?

Please Help me out.

Thanks!!


I wrote an example with two TableViews on one view. In my code each TableView has it own controller, as I can avoid if else blocks in my delegate methods, as this would lead to high and unwanted coupling.
These codes are very rough, as I was a beginner, when I wrote it. i.e. I am not using properties in it.
The TableViews itself can be added to their super view via Interface Builder.


A table view is just a view you can use. It doesn't have to be bound 1:1 to a view controller, but if it's not, you need to set up the custom single view controller that owns the screen, and then get it to own all three table views as subviews. You need to be careful about which object is the delegate and data source of each views, and do the right thing with providing cells, etc. If the same controller is the delegate/data source of all the table views, you have to switch in the delegate methods to do the right thing on each.


I just completed a section of my App and I was able to make multiple tableviews in one ipad display.

But the credit goes to another StackOverflow problem resolution team. Reading this I was able to determine the real issue and that gave me the root of the answer. The root cause issue is related to managing the dataSource and delegate of the TableView with a separate controller... You will need to closely read the answer. I did, and my App now works well.

Here is the item: UITableView issue when using separate delegate/dataSource

0

精彩评论

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