Xlpagertabstrip: dynamic changing pagerTabStripChildViewControllers

Created on 12 Aug 2015  路  7Comments  路  Source: xmartlabs/XLPagerTabStrip

I was trying to use XLButtonBarPagerTabStripViewController as extended ViewController,

using delegate method

- (NSArray *)childViewControllersForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController

to set @property NSMutableArray *tabCtrlsArray as return childViewControllers,

basic logic was one of the children view controller has sub detail view controller (under navigation controller) will trigger XLButtonBarPagerTabStripViewController to mutate tabCtrlsArray, then call reloadPagerTabStripView method to reload the contents.

However, reloadPagerTabStripView is not always changing the contents afterwards, which seems like some async issues.

But when I debug the process in XLButtonBarPagerTabStripViewController, the children view controllers seem changing correctly but not the view. And it happens randomly.

PS: In the sub detail view controller to get XLButtonBarPagerTabStripViewController:

PagerTabStripController *ptsCtrl = [self.storyboard instantiateViewControllerWithIdentifier:@"PagerTabStripCtrl"];
[ptsCtrl changeChildrenViewCtrls];

Is there any better way to mutate the pagerTabStripChildViewControllers in XLPagerTabStripViewController?

feature request

Most helpful comment

Hello guys,

I'd like to share how I solve this problem. It's quite simple.

  1. let newVC = self.storyboard.xxx
  2. childList.append(newVC) //or insert etc
  3. self.reloadPagerTabStripView() //you will see that newVC
  4. self.reloadInputViews() // I can't recall why wrote this line. Fix ButtonBarView synchronization problem?

IMPORTANT
There are many random functions in Example project.
REMOVE ALL SAMPLE CODES IF YOU DONT KNOW WHAT IT IS FOR!
All you need to do is return an array of UIViewControllers in override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController]

All 7 comments

@br1anchen,did you solve it out?I was doing the same thing,too.It was like google play store which page menu are changing dynamically.If you made it out,can you share me please?

Any Solution for this?

My question, too!

+1

Hello guys,

I'd like to share how I solve this problem. It's quite simple.

  1. let newVC = self.storyboard.xxx
  2. childList.append(newVC) //or insert etc
  3. self.reloadPagerTabStripView() //you will see that newVC
  4. self.reloadInputViews() // I can't recall why wrote this line. Fix ButtonBarView synchronization problem?

IMPORTANT
There are many random functions in Example project.
REMOVE ALL SAMPLE CODES IF YOU DONT KNOW WHAT IT IS FOR!
All you need to do is return an array of UIViewControllers in override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController]

Related issue #349

Was this page helpful?
0 / 5 - 0 ratings

Related issues

miguelgutierrezhcd picture miguelgutierrezhcd  路  10Comments

tannt275 picture tannt275  路  12Comments

ShockUtility picture ShockUtility  路  10Comments

royatv picture royatv  路  10Comments

niuguoning picture niuguoning  路  14Comments