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
- Swift ios 9: Section header change position after reload data
- iOS 7 Custom TableView Is Under TabBar
- Swift: Tableview scrolls under navigation bar but over status bar?
- and more
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.