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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:59:29+00:00 2026-05-15T18:59:29+00:00

i want to add buttons on to my tab bar programmatically in my view…

  • 0

i want to add buttons on to my tab bar programmatically in my view…

i am having navigation controller but it does not allow me to add these ..
i want to create programmatically in my view…

  • 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-15T18:59:29+00:00Added an answer on May 15, 2026 at 6:59 pm

    Since a tab bar controller is a container view controller that you use to divide your application into two or more distinct modes of operation, most apps have navigation controllers as children of tab bar controllers.

    Apple’s position is this:

    You use tab bar controllers in
    situations where your application
    either presents different types of
    data or presents the same data in
    significantly different ways.

    That is not to say you cannot do things differently… The main question you have is that you have already placed a Nav Controller in the app and you want to create the tab bar controller programmatically. The only way I can therefore see this is that you don’t mind if the tabbar controller changes each time you change screens within the Nav Controller. Some apps work this way. Most do not.

    If my assumptions above are true I would suggest you rethink your code to see if you want to pursue this line of development. If so, you can easily create a tabbar controller and attach it within the current view.

    Here is code I use to create my setup for one of my apps:

    // set up a local nav controller which we will reuse for each view controller
    UINavigationController *localNavigationController;
    
    // create tab bar controller and array to hold the view controllers
    UITabBarController *tabBarController = [[UITabBarController alloc] init];
    
    NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:1];
    
    // setup the first view controller (Root view controller)
    RootViewController *myViewController;
    myViewController = [[RootViewController alloc] initWithTabBar];
    
    // create the nav controller and add the root view controller as its first view
    localNavigationController = [[UINavigationController alloc] initWithRootViewController:myViewController];
    localNavigationController.navigationBar.barStyle = UIBarStyleBlack;
    localNavigationController.delegate = self;
    
    [localControllersArray addObject:localNavigationController];
    
    // release since we are done with this for now
    [localNavigationController release];
    [myViewController release];
    
    tabBarController.viewControllers = localControllersArray;
    tabBarController.moreNavigationController.navigationBar.barStyle = UIBarStyleBlack;  
    
    tabBarController.delegate = self;
    tabBarController.moreNavigationController.delegate = self;
    
    // release the array because the tab bar controller now has it
    [localControllersArray release];
    
    self.tabBarController.selectedIndex = 0;
    
    // add the tabBarController as a subview in the window
    [window addSubview:tabBarController.view];
    
    // need this last line to display the window (and tab bar controller)
    [window makeKeyAndVisible];
    

    There are so many situations where I feel it is easier to do everything programatically.

    Hope this helps.

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

Sidebar

Related Questions

I want to add haptic feedback to my application's buttons and control them programmatically
iPhone application, which has two buttons -right side- of Navigation Bar title. I want
I have a naviation controller. I create a tab bar controller and add 3
As i am newbie i want to add navigation controller with tabbar controller and
My iPhone app has a tab bar controller at the bottom of the view
Hello I am using a tab bar application. I want to reload a view
I have been developing an Android RSS news reader.I want to add two buttons
I have a loop displaying records, and I want to add submit buttons to
I tried to add buttons, textboxes and text to tableview. I want the row
I am using C#.net I want to add custom edit/delete buttons to my GridView1

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.