Skip to content

Option to deselect tabbar items #5

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions InfiniTabBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
- (int)selectedItemTag;
- (BOOL)scrollToTabBarWithTag:(int)tag animated:(BOOL)animated;
- (BOOL)selectItemWithTag:(int)tag;
- (void) deSelectAllTabs;
- (void) disableTabItemWithTag:(int)tag;
- (void) enableTabItemWithTag:(int)tag;

@end

Expand Down
28 changes: 28 additions & 0 deletions InfiniTabBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,34 @@ - (void)tabBar:(UITabBar *)cTabBar didSelectItem:(UITabBarItem *)item {
[infiniTabBarDelegate infiniTabBar:self didSelectItemWithTag:item.tag];
}

- (void) deSelectAllTabs{
for (UITabBar *tabBar in self.tabBars){
tabBar.selectedItem = nil;
[tabBar setNeedsDisplay];
}
}

- (void) disableTabItemWithTag:(int)tag{
for (UITabBar *tabBar in self.tabBars){
for(UITabBarItem *anItem in tabBar.items){
if(anItem.tag == tag){
[anItem setEnabled:NO];
}
}
}
}

- (void) enableTabItemWithTag:(int)tag{
for (UITabBar *tabBar in self.tabBars){
for(UITabBarItem *anItem in tabBar.items){
if(anItem.tag == tag){
[anItem setEnabled:YES];
}
}
}
}


- (void)dealloc {
[bTabBar release];
[aTabBar release];
Expand Down