ArmandsB ArmandsB - 2 months ago 12
iOS Question

Two UITableViews in one scrollview

I want to make

UIViewController
, which has 2
UITableViews
- one is content tableview, second is an comments section tableview.

Basically, It's an detail product VC, which has own
UITableView
for own content and second
UITableView
will be CommentsVC tableview.

Problem is that, I want to get them like one whole tableView (scroll together) (like 2 section style).

My first idea was to create
UIScrollView
container, which contains both
UITableViews
, but I think that there will be problem with reusing cells.

Example sketch

Answer

When you take tableview inside scrollview it creates problem in scrolling i.e conflicting scrolls of both scrollview and tableview as UIScrollview is superview of UITableView .

So it's better to take one UITableView with different section. One Section for your content and another section for comments.

Comments