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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:58:33+00:00 2026-05-29T17:58:33+00:00

I have created a tabbar through nib with three items in a view based

  • 0

I have created a tabbar through nib with three items in a view based application.
I want first item get selected by default when the view appear.

The problem is item1 show selected but it doesnt load the view it is entitled to do. when we click on the item the view appears. Please help me to sort out this. here Is my code…

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    tabBar.delegate = self;
    [tabBar setSelectedItem:[tabBar.items objectAtIndex:0]];
}

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
    NSLog(@"didSelectItem: %d", item.tag);
    if (item.tag==1) {
        ImagesOverlay=[[UIView alloc]initWithFrame:CGRectMake(0, 210, 320, 250)];
        ImagesOverlay.backgroundColor=[UIColor grayColor];
        [self.view addSubview:ImagesOverlay];
    }else if (item.tag==2) {
        relatedOverlay=[[UIView alloc]initWithFrame:CGRectMake(0, 210, 320, 250)];
        relatedOverlay.backgroundColor=[UIColor redColor];  
        [self.view addSubview:relatedOverlay];
    }else if(item.tag==3){
        //other condition
    }
}
  • 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-29T17:58:34+00:00Added an answer on May 29, 2026 at 5:58 pm

    Just got it done..

       -(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    tabBar.delegate = self;
    [tabBar setSelectedItem:[tabBar.items objectAtIndex:0]];
    [self activateTab:1];
     }
    
    - (void)activateTab:(int)index {
    switch (index) {
        case 1:
        //condition
        break;
        case 2:
       //condition
        break;
        default:
            break;
    }
     }
    
      - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
    NSLog(@"didSelectItem: %d", item.tag);
    [self activateTab:item.tag];    
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have created a TabBar Application. I Added to a view an UITableView and
I have created a tabbar based project and my first tab have a navigation
I have following problem. I have created a tab based Application with three Views
I have created tab bar programmatically in the view controller. In my application, Initially
I have a TabBar which has been created programmatically. In the view controllers of
I created a window application, which has a tabbar controller with four tabbar items.
I have created a custom tabbar in my application (using TabHost and TabWidget ).
I've created a tab bar application. I have four tabs; on the selected tab,
i am creating an application which make uses of tabbar.i have created a function
I have a TabBar that I've created through IB, I chose create new project

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.