0

I am using a Tabbarcontroller with navigation bar. There are two ViewControllers in the Tabbarcontroller. There is a search bar and below it i display a table. This table is grouped normally. It displays date based grouped customCellA, and the date is my header. When searching I clear the header height (to zero) and and display a single section. This section contains search result displayed in customCellB.

All the above ui have been created in storyboard

When I switch between tabbars and come back to this viewController. The gap between the search bar (which includes header) and the first cell group seems to increase.

I tried different options like (mostly in viewwillappear)

  • Calling reloadData() twice
  • calling tableView.layoutSubviews()
  • automaticallyAdjustsScrollViewInsets
  • contentOffset
  • edgesForExtendedLayout

Should i use them in viewdidlayoutsubviews...?

I Used folllowin links

Nothing seems to work. I am not sure where i am going wrong. I am using swift3 and xcode 8.3.X

I am unable to show the error here as its official project. Please suggest a possible solution.

Pasific_Dev
  • 13
  • 1
  • 4

1 Answers1

0

What I did for my project was just make the table view top constraint flush against the top of the whole screen, above the navigation bar.

  • I did that.. i connected the table view top constraint connect to top of the whole view (ViewController top). Dint work. – Pasific_Dev Jul 31 '17 at 21:20
  • Normally fist time loading the ViewConroller with the table view. It works fine. This issue of header moving down happens only when switching between tabs. If i go the second tab and come back to the first tab (which contains the able view) header seems to go down. I doubt if its and issue with the constraints or issue with parent view. – Pasific_Dev Jul 31 '17 at 21:23