2 UITableViews in one UIView

后端 未结 5 1372
一生所求
一生所求 2020-12-02 23:23

I have a UIView that will need to display two UITableViews, but they are never shown together, by using a SegementedBar you can toggle one or the o

5条回答
  •  臣服心动
    2020-12-02 23:51

    In my current app, I need to have 4 UITableView in a single UIViewController, at once I've to show single table, based on the tab selected by the user, I've added four tables because, all of having different custom cells and functionality, to reduce complexity I took four.

    The main benefit of this is that, each time you don't need to call reloadData to update a single table. I just need to properly handle table's show & hide flow. And believe me that's looks cool. Not flicking at all.

    In my case, I am creating four tables by code only. And I make a method that will return me a table based upon a tag I've pass.

    I keep cellForRowAtIndexPath as small as possible by dividing code into different functions.

提交回复
热议问题