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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:30:41+00:00 2026-05-30T23:30:41+00:00

in my viewcontroller,I want to add the uitabbar UITabBar *tabBar = [[UITabBar alloc]initWithFrame:CGRectMake(0, 410,

  • 0

in my viewcontroller,I want to add the uitabbar

UITabBar *tabBar = [[UITabBar alloc]initWithFrame:CGRectMake(0, 410, 320, 50)];
    UITabBarItem *item0 = [[UITabBarItem alloc]initWithTitle:@"first" image:[UIImage imageNamed:@"FirstTab.png"] tag:0];
    NSLog(@"item0.title = %@",item0.title);
    NSLog(@"item0.tag = %@",item0.tag);
    UITabBarItem *item1 = [[UITabBarItem alloc]initWithTitle:@"second" image:[UIImage imageNamed:@"SecondTab.png"] tag:1];
    UITabBarItem *item2 = [[UITabBarItem alloc]initWithTitle:@"third" image:[UIImage imageNamed:@"ThirdTab.png"] tag:2];
    UITabBarItem *item3 = [[UITabBarItem alloc]initWithTitle:@"forth" image:[UIImage imageNamed:@"ForthTab.png"] tag:3];
    UITabBarItem *item4 = [[UITabBarItem alloc]initWithTitle:@"fifth" image:[UIImage imageNamed:@"FifthTab.png"] tag:4];
    tabBar.delegate = self;
    NSArray *array = [[NSArray alloc]initWithObjects:item0,item1,item2,item3,item4, nil];
    [tabBar setItems:array animated:NO];
    [tabBar setSelectedItem:item0];

    [self.view addSubview:tabBar];
    [tabBar release];

and this is my log:

2012-03-04 10:38:54.839 MagicWords[1265:f803] item0.title = first
2012-03-04 10:38:54.840 MagicWords[1265:f803] item0.tag = (null)

so my ploblem is why the tag is null,but the title is right.
thank you in advance.

  • 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-30T23:30:42+00:00Added an answer on May 30, 2026 at 11:30 pm

    tag’s type is NSInteger, so you should use %d to print it:

    NSLog(@"item0.tag = %d",item0.tag);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a ViewController Class which is my first view, I then add
I have a tableView and want to add a new viewController so that when
i had programetically add the tabbar as shown below:- FirstViewController *obj_FirstViewController = [[FirstViewController alloc]
I want to add Scroll View into ViewController. I have created viewcontroller by code.
I have a ViewController and I want to add 3 subviews in the content
I am loading a viewController via a storyboard segue and I want to add
i have a tabbar app with 4 tabs. i want to add a small
So I have a viewControllerA, and I want to add another View managed by
I want to show a specific ViewController (or dismiss) a View after performing an
I have in an app a viewController without a .xib, because I want to

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.