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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:07:23+00:00 2026-06-06T18:07:23+00:00

I want to edit UITabbarItems during the view life time. The background is that

  • 0

I want to edit UITabbarItems during the view life time.
The background is that I have an App with login view and according to whether the user is admin or not, the admin TabbarItem should be visible or not.

I’m using this code to initially create the UITabbarController in the AppDelegate:

// AppDelegate.m

settings = [[settingsViewController alloc] init];
settings.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Einstellungen" image:[UIImage imageNamed:@"settings.png"] tag:3];

self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:readState, friends, settings, nil];

When I try to manipulate the items later from another UIViewController, nothing happens and the UITabbar remains like it was before.
I actually tried two ways I could imagine:

[[self tabBarController] setToolbarItems:[[[self tabBarController] toolbarItems] arrayByAddingObject:admin] animated:NO];
[[self tabBarController] setViewControllers:[[[self tabBarController] viewControllers] arrayByAddingObject:admin] animated:NO];

How can I reach my goal? Thanks in advance, with kind regards, Julian

  • 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-06T18:07:24+00:00Added an answer on June 6, 2026 at 6:07 pm

    I figured out a workaround for my problem. I don’t really like to import the AppDelegate but it seems as the tabbarController property is not being automatically set for the UIViewControllers of a UITabbarController.

    // generate an instance of the needed UIViewController
    adminViewController *admin = [[adminViewController alloc] init];
    admin.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Admin" image:[UIImage imageNamed:@"admin.png"] tag:5];
    
    // get the AppDelegate instance
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    
    // get the »viewControllers« array of the AppDelegates UITabbarController as mutable array
    NSMutableArray *viewControllersArray = [NSMutableArray arrayWithArray:[[appDelegate tabBarController] viewControllers]];
    // insert the UITabbarItem of the needed UIViewController
    [viewControllersArray insertObject:admin atIndex:2];
    
    // Finally tell the app delegates UITabbarController to set the needed viewControllers
    [[appDelegate tabBarController] setViewControllers:viewControllersArray animated:NO];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to edit corresponding labels when the user selects a row. i have
I want to edit links when the user changes the value of a <input
I want to edit the css of a div element during .resize() event and
In my operation i want to edit an employee list. In this time am
I want to edit the user's username inside a UITableView. I added a UITextField
I want to edit this query =COUNTIFS('Sheet1'!E2:E465,7,'Sheet1'!F2:F465,2) so that when I drag/copy it sideways,
I want to edit the cell not its value but its background color. I
I have a WebBrowser control where I want to edit a field in the
I want to edit the config file of a program that is an XML:
We have some document on the server and want to edit thru asp.net application.

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.