Rao Rules
Rao Rules

Reputation: 325

How can I hide a tab Bar Item?

I have added a tab bar (UITabBar) in my iPhone application. I want to hide a tab Bar item through code? Is it possible?

Upvotes: 3

Views: 9172

Answers (5)

Artem
Artem

Reputation: 401

Just set alpha for tab you need to hide

UIView *tabItem = self.tabBar.subviews[0];
tabItem.alpha = 0.0;

Upvotes: 0

Cheetah Natara
Cheetah Natara

Reputation: 1

if you're using storyboard, you can set property of that storyboard "Hide Bottom Bar on Push" on the attributes inspector (the forth small item look like the face of human )

Upvotes: 0

Srinivas
Srinivas

Reputation: 983

U can Hide BY USING below Code

  for(id object in appDelegate.tabBarController.tabBar.subviews)
    {
        [object setHidden:YES];
    }

Upvotes: 2

Deepak
Deepak

Reputation: 437

myObject.hidesBottomBarWhenPushed=YES;

Upvotes: 0

Ajeet Pratap Maurya
Ajeet Pratap Maurya

Reputation: 4254

In the .h file declare a

 UIBarButtonItem *mybutton

@property (nonatomic, retain) IBOutlet UIBarButtonItem *mybutton;

attache it to your UiBarButton in IB

then in .m file do

  @synthesize mybutton;

  mybutton.hidden=YES;

Upvotes: 1

Related Questions