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

前端 未结 3 1542
心在旅途
心在旅途 2021-01-14 09:57

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 a

相关标签:
3条回答
  • 2021-01-14 10:31

    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.

    0 讨论(0)
  • 2021-01-14 10:32

    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.

    0 讨论(0)
  • 2021-01-14 10:39

    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 讨论(0)
提交回复
热议问题