antiguab / BATabBarController

A TabBarController with a unique animation for selection
https://antiguab.github.io/batabbarcontroller/
MIT License
1.06k stars 131 forks source link

views goes under tabbar #63

Open nikolindima opened 4 years ago

nikolindima commented 4 years ago

views goes under tabbar

antiguab commented 4 years ago

sample code? Video? any more details?

nikolindima commented 4 years ago

i fix it. but don't know how to make commit public var viewControllers: [UIViewController] = [] { didSet { var i = Int(viewControllers.count) - 1 while i >= 0 { let vc = viewControllers[i] if let vcView = vc.view, let tabBar = tabBar { self.view.insertSubview(vcView, belowSubview: tabBar) vcView.snp.makeConstraints { (make) in make.top.equalToSuperview() make.leading.equalToSuperview() make.trailing.equalToSuperview() make.bottom.equalTo(tabBar.snp.top) } } i -= 1 } } }

need to add constraints to view

nikolindima commented 4 years ago

Create pull request #64

nikolindima commented 4 years ago

As I say. views goes under tabbar. This is your example project

screen

pkasson commented 4 years ago

Same issue - when using a VC with content, nothing displays. The debug hierarchy shows nothing for the view. I created a simple VC with a single label - "zero". All VC's show in the hierarchy, but the view itself, for the VC that has 'zero' is showing its content on the tab bar controller. Any VC with real content, always shows up with nothing, and black background (picture included).

Screen Shot 2020-05-25 at 7 00 42 AM

pkasson commented 4 years ago

It appears that the view lifecycle is not complete by the time the tab bar controller gets the view, so it has nothing to render yet. If the VC bg color is set in viewDidLoad, you do see that color, but none of the components from the IB ... something is not handled in the correct order.

ghost commented 4 years ago

Timer.scheduledTimer(withTimeInterval: 0.1, repeats: false) { _ in self.view.addSubview(baTabBarController.view) }

Try this in your didload