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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:12:12+00:00 2026-06-14T09:12:12+00:00

I have a class with a tableView. I get no build errors, but when

  • 0

I have a class with a tableView. I get no build errors, but when I try to run the app, after I add a new item, nothing appears to happen. Here’s the code:

In .h

@interface entriesViewController : UIViewController <UITableViewDelegate>

@property (weak, nonatomic) IBOutlet UITableView *TableView;


-(IBAction)startEditing:(id)sender;
-(IBAction)newItem:(id)sender;
@end

In .m

#import "entriesViewController.h"
#import "LEItemStore.h"
#import "LEItem.h"

@interface entriesViewController ()

@end

@implementation entriesViewController
@synthesize TableView;

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

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [TableView reloadData];
}

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


-(IBAction)startEditing:(id)sender {

    if ([TableView isEditing])
    {
        [TableView setEditing:NO animated:YES];


    }
    else
    {
        [TableView setEditing:YES animated:YES];
    }
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [[[LEItemStore sharedStore] allItems] count];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];

    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"UITableViewCell"];
    }

    LEItem *p = [[[LEItemStore sharedStore] allItems]objectAtIndex:[indexPath row]];

    [[cell textLabel] setText:[p description]];

    return cell;
}

-(IBAction)newItem:(id)sender {
    LEItem *newItem = [[LEItemStore sharedStore] createItem];
    [TableView reloadData];
}


-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete)
    {
        LEItemStore *ps = [LEItemStore sharedStore];
        NSArray *items = [ps allItems];
        LEItem *p = [items objectAtIndex:[indexPath row]];
        [ps removeItem:p];

        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }
}

-(void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
{
    [[LEItemStore sharedStore] moveItemAtIndex:[sourceIndexPath row] toIndex:[destinationIndexPath row]];
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{


    //NSArray *items = [[LEItemStore sharedStore] allItems];
    //BNRItem *selectedItem = [items objectAtIndex:[indexPath row]];
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [[self TableView]reloadData];
}

It would appear as if the TableView isn’t reloading it’s data. By the way, all connections have been made. Absolutely nothing appears. Just my Toolbar, the TableView does not change even after I added an item.

  • 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-14T09:12:14+00:00Added an answer on June 14, 2026 at 9:12 am

    Ok so after clearing this in the comments, your problem is that you haven’t set the data source (you can also do this with an array controller).
    So you set the delegate and the data source:

    [TableView setDelegate:self];
    [TableView setdataSource: self];
    

    Then you declare the class to also implement the UITableViewDataSource protocol.
    And you provide the two fondamental methods (also optional methods are welcome):

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
    

    This is an example of a simple data source implementation that just has one label saying hello:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        UITableViewCell* cell=[[UITableViewCell alloc]init];
        UILabel* label= cell.textLabel;
        label.text= @"Hello";
        return cell;
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        return 1;
    }
    

    But now you know how to provide a more complex data source: if you have an array you can read the index path and then set the label using the objectAtIndex method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have class that extend FragmentActivity in it I add fragment to layout as
I have a tab bar item which shows users favorites in a tableview. I
I have a TableView that builds and draws ok, but then crashes on scrolling
In my tableview have custom cells that I initialize from a UITableViewCell class. I
I have a UITableView that uses JSON to to get new data from the
I have a data like BigArr, arr, ... declared in header: class TableView:public QWidget
I have Class and Student objects. Both have collection of another as property. Which
I have class LegacyClass which inherits OldBaseClass. I'm considering a change to introduce a
I have class grades that I need to check if a specific grade is
I have class with back reference: public class Employee : Entity { private string

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.