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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:16:04+00:00 2026-06-18T15:16:04+00:00

I am trying to make a simple iOS application that uses a UINavigationController two

  • 0

I am trying to make a simple iOS application that uses a UINavigationController two ViewController and a UITableView to display a list. The problem is that the table refuses to display the data from NSArray. All delegates are setup as you see in the pictures.

enter image description here

enter image description here

Every thing works if i create a xib file for the ViewController, but i dont need one more xib file if i can drag one more ViewController in Storyboard and to link it’s class to my ItemListViewController as you see in the first picture.

ItemListViewController.h

#import 

@interface ItemListViewController : UIViewController{
    NSMutableArray *tblDataSource;
    IBOutlet UITableView *tblSimpleTable;
}

@property (assign) NSMutableArray *tblDataSource;
@property (retain) IBOutlet UITableView *tblSimpleTable;

@end

ItemListViewController.m

#import "ItemListViewController.h"

@interface ItemListViewController ()

@end

@implementation ItemListViewController

@synthesize tblDataSource,tblSimpleTable;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"bg.png"]];
    self.tblSimpleTable.backgroundColor = background;
    [background release];

    NSArray * data = [NSArray arrayWithObjects:@"Egg Benedict", @"Mushroom Risotto", @"Full Breakfast", @"Hamburger", @"Ham and Egg Sandwich", @"Creme Brelee", @"White Chocolate Donut", @"Starbucks Coffee", @"Vegetable Curry", @"Instant Noodle with Egg", @"Noodle with BBQ Pork", @"Japanese Noodle with Pork", @"Green Tea", @"Thai Shrimp Cake", @"Angry Birds Cake", @"Ham and Cheese Panini", nil];
    [tblDataSource setArray:data];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    NSLog(@"@%d",[tblDataSource count]);
    return [tblDataSource count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell...
    UIImage *placeholder = [UIImage imageNamed:@"icon.png"];
    [cell.imageView setImage:placeholder];
    cell.textLabel.text = [tblDataSource objectAtIndex:indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"Clicked on row @%d",indexPath.row);
}

@end

If someone could point me in the right direction what am i doing wrong.

  • 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-18T15:16:06+00:00Added an answer on June 18, 2026 at 3:16 pm

    In numberOfSectionsInTableView you’re returning 0, which says there are no sections to generate (and therefore no rows, either). You probably want to return 1.

    Also, you want to make sure you retain your NSMutableArray, so you really want to do:

    @property (nonatomic, retain) NSMutableArray *tblDataSource;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fairly new to iOS development and trying make a simple app which
Trying to make simple minesweeper game in python, but have one problem. I have
I am trying to make simple notepad application for learning android development. So, to
I'm trying to make simple paint application, based on Apple's GLPaint. To draw a
New to ios programming so for practice I am trying to make a simple
I am new to iOS and trying to make my own simple app. I
Hello i'm trying to make a simple ios app with tabs and navigation .
I'm trying to make simple animation that would repeat several times (or infinitely). It
I am trying to make simple google map Application in android. my Apps. is
I am trying to make very simple element with new iOS 6 SDK with

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.