Skip to content

Some suggestions #4

Description

@sdrpa

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions