Xlpagertabstrip: XLButtonBarPagerTabStripViewController collectionview not working in iOS 9.2

Created on 10 Dec 2015  路  14Comments  路  Source: xmartlabs/XLPagerTabStrip

After updating to ios 9.2 the XLButtonBarPagerTabStripViewController buttonbarview at the top is only showing one of the tabs. After putting some breakpoints code, I found that even though numberOfItemsInSection for the collectionview is returning the correct amount (3), cellForItemAtIndexPath is only being called once. I'm not really sure why this is happening.

XLButtonBarPagerTabStripViewController

Most helpful comment

@mtnbarreto @RockyLin
So I was playing around and managed to reproduce the problem on one of my storyboards. My issue was actually the ordering of the button bar view and the container view. Once I made sure that the ButtonBarView was BELOW the container or scroll view in the scene (left pane in IB) then everything works like a charm, without any code changes or hacks.

All 14 comments

I'm seeing this too, you can swipe between pages and it works fine, the bar that highlights the selected tab is still working but the titles are gone , and you cant click on the tabs to change pages.

After playing around with it, I was able to fix this issue for my case by modifying XLButtonBarPagerTabStripViewController.m viewDidLoad(). I deleted if (!self.buttonBarView.superview){. I think it makes more sense to add the buttonBarView from within the superclass. I'm not sure if that will fix your issue. Let me know!

@niuguoning thanks so much! This works for me also, i wonder if you should put up a pull request?

I don't understand why this only manifests itself on iOS 9.2, any thoughts?

I encountered the same problem, and deleted if (!self.buttonBarView.superview), but it doesn't work....

@sdac @RockyLin @vigandhi In case we connect the buttonBarView IBOutlet the superview should be properly set up and the library expects to have a prototype cell registered which must be or extend the XLButtonBarViewCell class. Easier way to register the cell is through interface builder as the example project illustrates but you can also do it by code.

I've tested the master branch version of the example project and it seems that works fine.
Could you please check if you are still experiencing the issue using master branch?

@mtnbarreto thanks for looking into this. I'm currently using 1.1.1

I tried upgrading to 2.0.0, and I see the same problem. I just pulled down the tip of master and tried that, and i see none of my tab titles. Prior to this i would see the first title only.

Unfortunately i can't spend too much more time on this today but I will revisit it in the new year.

@vigandhi Are you creating the tabBarStrip view programmatically or using interface builder?
Really appreciate if you can take a look to it later. happy new year!

@mtnbarreto I'm using interface builder - copied everything from the demo project, which is why i had such a hard time figuring out what the issue was. What's really confusing is the first cell shows up correctly but the next n cells are blank.

@mtnbarreto to follow up, upgrading to the latest version (4.0.0) seems to have solved my issue - I didn't change my code at all (except renaming everything to the new names sans XL) and the tab titles show up now.

Thanks!

@vigandhi :+1: thanks for letting me know!

@mtnbarreto @RockyLin
So I was playing around and managed to reproduce the problem on one of my storyboards. My issue was actually the ordering of the button bar view and the container view. Once I made sure that the ButtonBarView was BELOW the container or scroll view in the scene (left pane in IB) then everything works like a charm, without any code changes or hacks.

@vigandhi Thanks for the clarification.

Ideally we should always use interface builder which easily allows us to add constraints to put the barButtonBar above the conteinerView.

We do recommend to use storyboards as this readme section points out: https://github.com/xmartlabs/XLPagerTabStrip#connect-outlets-and-add-layout-constraints

@vigandhi @mtnbarreto
I followed @vigandhi suggestion and it works like a charm, could @mtnbarreto explain why the buttonBarView move below to the container view in the IB panel will work? Just interested to know

Thank you @vigandhi.

Was this page helpful?
0 / 5 - 0 ratings