uias / Tabman

™️ A powerful paging view controller with interactive indicator bars
https://uias.github.io/Tabman
MIT License
2.86k stars 237 forks source link

TableView lost bottom inset after changing tab #261

Closed markuplab closed 6 years ago

markuplab commented 6 years ago

New Issue Checklist

Issue Description

Look this video: https://www.youtube.com/watch?feature=youtu.be&v=8O-1a41RKvU&app=desktop After you swipe changing tab, bottom insets feels good, but if you tap on tab, all broken.

My hierarchy: Tabman -> UIViewController -> UITableViewController + UISearchBar

My tabman controller code:

import UIKit
import Tabman
import Pageboy

class SearchViewController: TabmanViewController {
    override var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent
    }

    var viewControllers: [UIViewController] {
        return [
            TopPlayersViewController(),
            TopClansViewController()
        ]
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        self.navigationController?.setNavigationBarHidden(true, animated: false)

        // Load remote data
        loadTopClansAction()
        loadTopPlayersAction()

        self.bar.items = [
            Item(title: "Players"),
            Item(title: "Clans")
        ]

        self.dataSource = self

        self.bar.style = .scrollingButtonBar

        self.bar.appearance = TabmanBar.Appearance({(appearance) in
            // Indicator customization
            appearance.indicator.color = UIColor.sr_blue
            appearance.indicator.lineWeight = TabmanIndicator.LineWeight.thick

            // Layout customization
            appearance.layout.height = TabmanBar.Height.explicit(value: 44)
            appearance.layout.itemVerticalPadding = 13
            appearance.layout.itemDistribution = TabmanBar.Appearance.Layout.ItemDistribution.leftAligned
            appearance.layout.minimumItemWidth = UIScreen.main.bounds.width / 2
            appearance.layout.interItemSpacing = 0.0
            appearance.layout.edgeInset = 0.0

            // Font and Color customization
            appearance.state.selectedColor = UIColor.sr_white
            appearance.state.color = UIColor.sr_white.withAlphaComponent(0.5)
            appearance.text.font = UIFont.proximaSemiBold(ofSize: 13)

            // Style customization
            appearance.style.background = TabmanBar.BackgroundView.Style.solid(color: UIColor.sr_dark)
        })
    }
}

extension SearchViewController: PageboyViewControllerDataSource {
    func numberOfViewControllers(in pageboyViewController: PageboyViewController) -> Int {
        return self.viewControllers.count
    }

    func viewController(for pageboyViewController: PageboyViewController, at index: PageboyViewController.PageIndex) -> UIViewController? {
        pageboyViewController.bounces = false
        return self.viewControllers[index]
    }

    func defaultPage(for pageboyViewController: PageboyViewController) -> PageboyViewController.Page? {
        return nil
    }
}

Other useful things

msaps commented 6 years ago

@markuplab I think this might be related to #109, could you try updating the AutoInsetter dependency to v1.2.2 and see if that fixes the issue?

markuplab commented 6 years ago

@msaps Still actual, same behaviour

Gperez88 commented 6 years ago

same to me, I have same behaviour.

I have AutoInsetter (1.2.3) and Tabman (1.8.2)

In my case is with the first Item behind Tab bar. This happen when to click in the tab items, if change the page with swipe it doesn't happen whatsapp image 2018-04-20 at 5 40 38 am

msaps commented 6 years ago

@Gperez88 @markuplab would either of you be able to provide a demo project that reproduces this? Makes it a lot easier getting the scenario right to fix it. Much appreciated! 😄