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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:40:22+00:00 2026-05-13T12:40:22+00:00

I have a an app that has a UITabBarController . What I would like

  • 0

I have a an app that has a UITabBarController.
What I would like to achieve, is that the first ViewController included in the TabBar displays a TableView if there are items in the array property (loaded from CoreData), or a UIImageView (with more information about how to add items) if not.

If the user goes to a different TabBarItem, and comes back to the first TabBarItem the array could have been populated. So it should change what is displayed accordingly.
Could somebody post a programatic snippet to achieve this. I have tried several things, and none have worked properly.

  • 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-13T12:40:22+00:00Added an answer on May 13, 2026 at 12:40 pm

    This code does the job

    - (void)loadView {
    
        UIView* aView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
    
        //tableView
        self.tableView = [[[UITableView alloc ] initWithFrame:CGRectMake(0,0,320,460) style:UITableViewStylePlain] autorelease];
        self.tableView.backgroundColor = [UIColor clearColor];
        self.tableView.autoresizingMask = (UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight);                    
    
        self.tableView.delegate = self;
        self.tableView.dataSource = self;
        self.tableView.autoresizesSubviews = YES;
    
        [aView addSubview: tableView];
    
        self.view   = aView;
        [aView release];
    }
    
    - (void)viewDidAppear:(BOOL)animated {
        [super viewDidAppear:animated];
    
        [self loadData];
    
        //Display or remove Image depending on the ammount of results.
        if ([self.itemsArray count] == 0) {
            NSLog(@"No Items in Array");
    
            if (noDataImageView == nil) {
                noDataImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NoDataBackground.png"]];
                [self.view addSubview:noDataImageView];
            }
    
        }else{
            if(noDataImageView != nil){
                [noDataImageView removeFromSuperview];
            }
        }
    
    }
    
    - (void)dealloc {
        [super dealloc];
        [tableView release];
        [noDataImageView release];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that has a TableView, NavigationView and TabBar running together. There
I have an app that has a ListBox of ListBoxes. I would like to
I have an app that has a tabbar at the bottom. When I select
I have an app that has a UINavigationController that pushes a UITabBarController into view.
I have an app that has two viewcontrollers Viewcontroller and OptionsViewController. Viewcontroller is the
I have an app that has a tabBar Controller and a navBar Controller. It
I have an app with a primary view that has a UITabBarController with 5
I have an app that has a tabBar with a navbar, The tabBar is
I'm developing an iPhone app, where I have a UITabBarController that has a UINavigationController
Have an app that has listings - think classified ads - and each listing

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.