Xlpagertabstrip: Issue with Inset when using Translucent NavigationBar

Created on 6 Jun 2017  路  6Comments  路  Source: xmartlabs/XLPagerTabStrip

I have a problem with buttonBarView frame and strange containerView's frame changing in runtime.

Here is the gif
ezgif-1-202dd6b0e1

Or the link to the same with higher quality - https://im.ezgif.com/tmp/ezgif-1-6ae18b79c5.gif

I'm trying to configure all this from code, without using Storyboard.

So, the problem is that in case I use isTranslucent navigationBar, elements' frames are wrong... I tried to add constraints manually from code, but I cannot fix issue with containerView's frame, that changes each time I manually change the tab by clicking on the buttonBarView's item.

Most helpful comment

So, PageTabBarController from CosmicMind has this bug too.

And actually, it figured out it is not a bug in the pod, it is just a negative point of not using storyboard/xib.

Fixed the issue with self.edgesForExtendedLayout = []

All 6 comments

   override func viewDidLoad() {
        defaultXLTabStripColors()
        super.viewDidLoad()
        injectXLTabStripIntoNavBar()
        configureTabStripAfterViewDidLoad()
   }        


    func injectXLTabStripIntoNavBar(){
        containerView.frame = self.view.bounds // hack to fix XLPagerTabStrip without xib
        buttonBarView.removeFromSuperview()
        navigationController?.navigationBar.addSubview(buttonBarView)
    }

@johndpope this is not working. The line containerView.frame = self.view.bounds doesn't fix the issue. ContainerView frame still is changing to the wrong value when you manually click on the buttonBarView item.

Just for fun, I have tried to add buttonBarView, and it gives me a lot of problems :) First of all I need to remove buttonBarView once I pop to previous viewController. Also, the actual content of the navigationBar got hidden by buttonBarView which was expected actually

These solutions don't work for me. Also, they don't actually look like solutions, but more like hacks, which I believe is not a good way.

I'm not sure if you are a developer of this pod, or someone else... Are you able to fix the issue with having translucent navigationBar and containerView frame bug? Maybe there are a list of constraints that I could set to make it works as expected?

Also, I don't understand what is the idea to change containerView frame each time the tab is changed at all... Maybe there were some issues because of the fact that containerView is a scrollView. For such libraries it looks more native to use UIPageController, doesn't it?

I am simply a user of the pod, not the developer.
I had trouble with the navigation control part of the library as it wasn't built to do things programmatically, it's expecting a storyboard. Feel free to rebuild entire library so it's not a 'hack'.
This is a related architectural design bug for more background.
https://github.com/xmartlabs/XLPagerTabStrip/issues/299

When you click the other item, and you say the bounds are wrong,
try forcing it again to correct
containerView.frame = self.view.bounds

IC. I would probably find another pod instead.

And will keep this issue opened just in case some of the developers really read these issues :)

Thanks

So, PageTabBarController from CosmicMind has this bug too.

And actually, it figured out it is not a bug in the pod, it is just a negative point of not using storyboard/xib.

Fixed the issue with self.edgesForExtendedLayout = []

Was this page helpful?
0 / 5 - 0 ratings

Related issues

miguelgutierrezhcd picture miguelgutierrezhcd  路  10Comments

BasantAshraf picture BasantAshraf  路  13Comments

miranda-elliott picture miranda-elliott  路  11Comments

always19 picture always19  路  23Comments

pmendiburu picture pmendiburu  路  16Comments