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 8796857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:43:04+00:00 2026-06-13T23:43:04+00:00

So im trying to make an application with a UITabBar not a UITabBarController so

  • 0

So im trying to make an application with a UITabBar not a UITabBarController so i declared the UITabBar in my headers as to make it acessable from all my methods, so to make it i just did:

tabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0, 430, 320, 50)];
[self.view addSubview:tabBar];

and i used an NSMutableArray to add my objects… but in my headers i also delcaired:

@interface RootViewController: UIViewController {
IBOutlet UITabBar *tabBar;
}
@property (nonatomic, retain) UITabBar *tabBar;
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item;

an then i made a simple function to go along with it:

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
    NSLog(@"didSelectItem: %d", item.tag);
}

But then when I go into the app and try to change the tab, the log returns nothing, the selected tab changes, but my log gets nothing! I’ve seen this function set up to do this job all over the internet, and i dont understand why it wont work for my code.
So could anybody mybe tell me what im doing wrong that this function wont pick up the tab change?

  • 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-06-13T23:43:05+00:00Added an answer on June 13, 2026 at 11:43 pm

    In RootViewController.h, do this:

    @interface RootViewController : UIViewController
    
    @end
    

    In RootViewController.m, do this:

    @interface RootViewController () <UITabBarDelegate>
    @end
    
    @implementation RootViewController {
        UITabBar *tabBar;
    }
    
    #pragma mark UITabBarDelegate methods
    
    - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
        NSLog(@"didSelectItem: %d", item.tag);
    }
    
    #pragma mark UIViewController methods
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        tabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0, 430, 320, 50)];
        tabBar.delegate = self;
        [self.view addSubview:tabBar];
    }
    
    @end
    

    This layout takes advantage of the new LLVM compiler features of modern Objective-C.

    You don’t need a property since no user of the class needs access to the tab bar. You don’t need to mark anything as an IBOutlet since you aren’t using Interface Builder to setup the tab bar. You don’t declare the tab bar delegate method in the .h file since no client of the class will be calling that method.

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

Sidebar

Related Questions

i'm trying to make an application, getting all the birthdays and other information from
I'm trying to make my application grab a photo from the user's Photo library
I am trying to make gallery application in which all media file are arranged
I am trying to make an application, which reads the data from a serial
I'm trying to make our application more resilient to downtime from our search server.
I am trying to make a application where a dialog will come from where
I'm trying to make my application handle some conversions of DateTimes from string. In
I'm trying to make application for tablet with Android 2.3 with this kind of
I am trying to make my application device administrator , i followed some notes
I am trying to make my application to use lookaside lists for memory management.

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.