Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some suggestions #4

Open
sdrpa opened this issue Jun 7, 2012 · 1 comment
Open

Some suggestions #4

sdrpa opened this issue Jun 7, 2012 · 1 comment

Comments

@sdrpa
Copy link

sdrpa commented Jun 7, 2012

In the init:


_oldSelectedTabBarItemIndex = -1; // When nothing is selected 

- (void)infiniteTabBar:(InfiniteTabBar *)tabBar didSelectItemWithTag:(int)tag {
   // Prevent to fire didSelectItemWithTag: if the item is already selected
   if (tag == _oldSelectedTabBarItemIndex) {
      return;
   }
   // Sometimes last seelcted item was on second tabbar but by default always first tabbar will be displayed on load, we need to scrol to tabbar which contains selected item. I need this because app. remembers last selected tag on exit and restores state on load ..
   NSInteger tabItemsPerTabBar = 5;
   if (tag / tabItemsPerTabBar >= 1.0) {
      int indexOfTabBarForSelectedItem = (int)(tag / tabItemsPerTabBar);
      if (self.tabBar.currentTabBarTag != indexOfTabBarForSelectedItem) {
         [self.tabBar scrollToTabBarWithTag:indexOfTabBarForSelectedItem animated:NO];
      }
   }
   _oldSelectedTabBarItemIndex = tag;
      }
   }

I did this in my viewController which is InfiniteTabBarDelegate. May be this should be done as part of InfiniteTabBar implementation. Anyway InfiniteTabBar is a great component. Thank you.

@iosdeveloper
Copy link
Owner

Feel free to fork and request a pull ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants