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

Already on GitHub? Sign in to your account

Tab at Bottom #11

Open
cannyboy opened this Issue Jul 3, 2012 · 0 comments

Comments

Projects
None yet
1 participant

cannyboy commented Jul 3, 2012

Apps with vertical tab bars, like Instapaper and Spotify, often have tabs at the bottom, separated from the main tabs.

I did this with NGTabBarController, by adding a BOOL property to NGTabBarItem:

@property (readwrite, assign) BOOL atBottom;

Then I changed some code in NGTabBar.m

// re-position each item starting from current top/left
for (NGTabBarItem *item in self.items) {
    CGRect frame = item.frame;

    frame.origin.y = currentFrameTop;
    frame.origin.x = currentFrameLeft;
    item.frame = frame;



    // move to next item position
    if (NGTabBarIsVertical(self.position)) {
        currentFrameTop += frame.size.height;
        currentFrameTop += appliedItemPadding;
    } else {
        currentFrameLeft += frame.size.width;  
        currentFrameLeft += appliedItemPadding;
    }

    if (item.atBottom)
    {
        item.frame = CGRectMake(frame.origin.x, (self.frame.size.height - frame.size.height)-appliedItemPadding, frame.size.width, frame.size.height);
    }

}

Only works for vertical tab bars, so would probably need a more robust system.. perhaps like UIToolbars with fixed and flexible spacing items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment