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

  • Home
  • SEARCH
  • 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 7409645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:06:51+00:00 2026-05-29T06:06:51+00:00

I currently have a tab bar application in the works, and have run into

  • 0

I currently have a tab bar application in the works, and have run into a bit of a roadblock. No data is populated in the table view, When i try to load my TableViewController with records from an NSMutable array.

RootViewController methods – which is the TableViewController

- (id)init
{
//Call the superclass's designated initalizer
self = [super initWithNibName:nil bundle:nil];

if (self){

    //Populate NSMutalableArry with all pub objects 

    for(int i=0; i<10; i++){
        [[PubStore defaultStore] createPub];
        //j = [[[[PubStore defaultStore] allPubs] objectAtIndex:i] getPubName];

    }

    //Get the tab bar item
    UITabBarItem *tbi = [self tabBarItem];

    //Give it a label
    [tbi setTitle:@"Pubs"];

    //Create a UIImage from a file
    UIImage *i = [UIImage imageNamed:@"88-beermug.png"];

    //Put Image on the tab bar item
    [tbi setImage:i];




}

return self;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {


return [[[PubStore defaultStore] allPubs] count];

}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath   *)indexPath {
// Create an instnce of UITableViewCell, with default appearance
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"UITableViewCell"] autorelease];

//Set the text on the cell with the description of the possession
//that is at the nth index of the possessions, where n =row this cell
//will appear in on the tableview

Pub *p = [[[PubStore defaultStore] allPubs] objectAtIndex:[indexPath row]];
NSLog(@"Display Pub Name: %@", [p getPubName]);    
[[cell textLabel] setText: [p getPubName]];


return cell;
}

PubStore Methods

- (id)init
{

if (defaultStore) {
    //Return the old Default Store
    return defaultStore;

}

self = [super init];
if(self){
    allPubs = [[NSMutableArray alloc] init];
}
return self;
}

- (NSArray *)allPubs
{
return allPubs;
}


- (Pub *)createPub
{
//* random possessions does not exist in my Pub Class
Pub *p = [Pub randomPub];
NSLog(@"New Pub: %@", p); 
[allPubs addObject:p];


return p;
}

Any help you could provide me would be greatly appreciated, i’m in the progress of learning objective c and this is one roadblock that i need to get passed.

  • 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-29T06:06:51+00:00Added an answer on May 29, 2026 at 6:06 am

    I found the source of the issue. I was returning 0 instead of 1 in the numberOfSectionsInTableView: method. I mistakenly modified this method, and doing so was telling the program that there are no row sections to populate.

    Incorrect Method

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        return 0;
    }
    

    Correct Method

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        return 1;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tab bar application and when I display a modal view controller,
i have an application which uses CoreData/.sqlite to store my data, a tab bar
I currently have an iPhone project with a tab bar. On the tabbar there
I have a tab bar controller (its a tab bar based application, so tab
I have a tab bar application, with many views. Is there a way to
I have an ios5 app developed using storyboards that currently displays a tab bar
I have an application that has many views (Using tab bar controller). I want
I currently have an application that does the the following: S: Loads a view
so I have a tab bar application where i have put a button to
I have a tableview in the midddle of my tab bar template application.. I

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.