Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6086789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:47:44+00:00 2026-05-23T11:47:44+00:00

using this tutorial I set up a custom TabBar. Unfortunately the tutorial won’t describe

  • 0

using this tutorial I set up a custom TabBar. Unfortunately the tutorial won’t describe how to hide the custom TabBar in views you don’t wanna display it.

In my customTabBar.h I defined

- (void) hideAlsoCustomTabBar;
- (void) showCustomTabBarAgain;

which are implemented as

- (void) hideAlsoCustomTabBar {

    btn1.hidden = YES;
    btn2.hidden = YES;
    btn3.hidden = YES;  
    btn4.hidden = YES;
}

- (void) showCustomTabBarAgain {

    btn1.hidden = NO;
    btn2.hidden = NO;
    btn3.hidden = NO;
    btn4.hidden = NO;
}

Calling those inside CustomTabBar.m‘s viewDidAppear works fine and does exactly what I expect them to do. If I try to call those methods from the ViewController where I need to hide the TabBar like this

[customTabs hideAlsoCustomTabBar];

inside the initWithNibName OR viewDidLoad OR viewWillAppear, nothing will happen. I checked with NSLog, the method gets called, but when I read out the BOOL for any buttons .hidden attribute, it returns 0, when it should be 1 (for hidden==YES).
I don’t know what’s wrong with my setup. Is it possible these button’s attributes are private by default as CustomTabBar inherits from UITabBarController and I can’t set them? Or did I make a mistake in the call?

Thanks!
EDIT
The TabBar implementation as it is described in the tutorial

import "CustomTabBar.h"
@implementation CustomTabBar

@synthesize btn1,btn2,btn3,btn4;

- (void) viewDidAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self hideExistingTabBar];
[self addCustomElements];
}

- (void) hideExistingTabBar {
for (UIView *view in self.view.subviews) {
    if ([view isKindOfClass:[UITabBar class]]) {
        view.hidden = YES;
        break;
    }
}
}

- (void) addCustomElements {
//Initialise the two images for btnEinleitung, not selected and selected
UIImage *btnImage = [UIImage imageNamed:@"btnEinl.png"];
UIImage *btnImageSelected = [UIImage imageNamed:@"btnEinl_s.png"];

self.btnEinleitung = [UIButton buttonWithType:UIButtonTypeCustom]; 
btnEinleitung.frame = CGRectMake(0, 430, 86, 50);
[btnEinleitung setBackgroundImage:btnImage forState:UIControlStateNormal];
[btnEinleitung setBackgroundImage:btnImageSelected  forState:UIControlStateSelected];   
[btnEinleitung setTag:0];
[btnEinleitung setSelected:true];

//set other buttons
btnImage = [UIImage imageNamed:@"btnUbg.png"];
btnImageSelected = [UIImage imageNamed:@"btnUbg_s.png"];
self.btnUebungen = [UIButton buttonWithType:UIButtonTypeCustom];
btnUebungen.frame = CGRectMake(86, 430, 80, 50);
[btnUebungen setBackgroundImage:btnImage forState:UIControlStateNormal];
[btnUebungen setBackgroundImage:btnImageSelected forState:UIControlStateSelected];
[btnUebungen setTag:1];

   /* do the same for btn3 and btn4*/


//add custom buttons to view
[self.view addSubview:btn1];
[self.view addSubview:btn2];
[self.view addSubview:btn3];
[self.view addSubview:btn4];

//setup event handlers so the buttonClicked method will respond to the touch up inside event
[btn1 addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[btn2 addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[btn3 addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[btn4 addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];

}

//set tab to active according to the passed tag number 
- (void) selectTab:(int)tabID {
switch (tabID) {
    case 0:
        [btnEinleitung setSelected:TRUE];
        [btnUebungen setSelected:FALSE];
        [btnTipps setSelected:FALSE];
        [btnBrauchtum setSelected:FALSE];

        btnEinleitung.userInteractionEnabled = NO;
        btnUebungen.userInteractionEnabled = YES;
        btnTipps.userInteractionEnabled = YES;
        btnBrauchtum.userInteractionEnabled = YES;
        break;
    case 1:
        [btnEinleitung setSelected:FALSE];
        [btnUebungen setSelected:TRUE];
        [btnTipps setSelected:FALSE];
        [btnBrauchtum setSelected:FALSE];

        btnEinleitung.userInteractionEnabled = YES;
        btnUebungen.userInteractionEnabled = NO;
        btnTipps.userInteractionEnabled = YES;
        btnBrauchtum.userInteractionEnabled = YES;
        break;
// and so on for 2 and 3
    }
self.selectedIndex = tabID;
}

//get the tag of the sender/pressed button, call the function selectTab
- (void) buttonClicked:(id)sender {
int tagNum = [sender tag];
[self selectTab:tagNum];
}

EDIT
As described below, I have 4 Tabs in a Tabbar which was generated with IB, added Navigation Controller with their ViewControllers, made Outlets for those and connected them in IB.
Clicking on the second Tab (e.g. sndMenuVC) opens a view with 4 buttons. Clicking one of these buttons leads to another view (e.g. detailVC) in which I don’t want the TabBar to be displayed. detailVC has it’s own nib.
Opening detailVC happens with the button’s action declared like this

- (IBAction) openFourth:(id)sender{
detailVC *detailView = [[detailVC alloc] initWithNibName:@"detailVC" bundle:nil andSender:kFourthButtonSender];
[self.navigationController pushViewController:detailView animated:YES];
[detailView release];
}

As this is a custom initWithNibName, this is how I implemented it

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil andSender: (NSString *)calledByButton{
self.callingButton = calledByButton;
[super initWithNibName:@"detailVC" bundle:nil];
return self;
}

SO I basically just set a global variable “callingButton” according to the transmitted sender and call the “normal” initWithNibName afterwards.

This all works fine.

If I try to call hideAlsoCustomTabBar, and NSLog the value of btn1.hidden it returns 0 when called from detailVC, but returns 1 when called from within CustomTabBar and actually hides the buttons.

I have customTabs as IBOutlet if needed, but don’t know if this is connected correctly to the TabBarController of type CustomTabBar.

IB Setup

Hope this helps to understand me 🙂 If you need any other information, just let me know.
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:47:45+00:00Added an answer on May 23, 2026 at 11:47 am

    I have written a follow up to my RXCustomTabBar tutorial which should answer your questions. I don’t see any point reproducing it in full here.

    Hiding your New Custom UITabBar (RXCustomTabBar follow up)

    Let me know if you have any questions,
    Oli

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello i am using this tutorial to set the spinwheel for my webview ,
I am trying to set transparent panel using this tutorial in my app but
I set up JMF using this tutorial http://www.deitel.com/articles/java_tutorials/20060422/PlayingVideowithJMF/ . I set up the mp3
I'm using this tutorial: http://android-developers.blogspot.com/2011/04/customizing-action-bar.html I set a drop down list theme like this
I followed this tutorial: https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf However, I can't seem to set the path right.
I am using this tutorial to create a login form http://www.ryancoughlin.com/2008/11/04/use-jquery-to-submit-form/ It authenticates against
I built a Jquery dropdown menu using this tutorial . It works across browsers
I just installed Glassfish on my Ubuntu server (No GUI) using THIS tutorial. Everything
I'm trying to get Django running on GAE using this tutorial . When I
I'm following the Railscasts tutorial on using OpenID with AuthLogic . This command: $

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.