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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:49:07+00:00 2026-05-29T21:49:07+00:00

I have an app consisting of a TabBar with a few TabBarControllers. One Controller

  • 0

I have an app consisting of a TabBar with a few TabBarControllers. One Controller contains a very simple table, which is supposed to display the contents of a NSMutableDictionary. When you hit the appropriate button, the Dictionary is updated in a separate Controller and the view switches to the UITableViewController, displaying the newly updated table.

I can see the Dictionary being updated. But the TableView never reflects the changes. In fact, it seems to display the changes only the 1st time I enter that screen.

I have tried [self table.reloadData] and while it gets called, the changes aren’t reflected to the UITableView.

Does anyone have any suggestions? I am happy to post code, but am unsure what to post.

Update: the table is updated and refreshed properly only the 1st time it is displayed. Subsequent displays simply show the original contents.

Background:
The tableview gets filled from a dictionary: appDelegate.currentFave. The tableview should get refreshed each time the ViewController is invoked by the TabBarController.

- (void)viewWillAppear:(BOOL)animated
{
    NSLog(@"in viewWillAppear");

    [super viewWillAppear:animated];

    [self loadFavesFile];
    [self.tableView reloadData];
}

// load the Favorites file from disk
- (void) loadFavesFile 
{   
// get location of file
NSString *path = [self getFavesFilePath];

// The Favorites .plist data is different from the Affirmations in that it will never be stored in the bundle. Instead,
// if it exists, then use it. If not, no problem.
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {

    // read Faves file and store it for later use...
    NSMutableDictionary *tempDict = [NSMutableDictionary dictionaryWithContentsOfFile:path];
    appDelegate.sharedData.dictFaves = tempDict;    

    // grab the latest quote. Append it to the list of existing favorites
    NSString *key = [NSString stringWithFormat:@"%d", appDelegate.sharedData.dictFaves.count + 1];

    NSString *newFave = [NSString stringWithFormat:@"%@", appDelegate.currentFave];
    [appDelegate.sharedData.dictFaves setObject:newFave forKey:key];

} else {
    NSLog(@"Favorites file doesn't exist");
    appDelegate.sharedData.dictFaves = nil;     
}
}


// this gets invoked the very first call. Only once per running of the App.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// reuse or create the cell
static NSString *cellID = @"cellId";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:cellID];  
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}

// allow longer lines to wrap
cell.textLabel.numberOfLines = 0; // Multiline
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.textLabel.font = [UIFont fontWithName:@"Chalkduster" size:(16)];
cell.textLabel.textColor = [UIColor yellowColor];   

// NOTE: for reasons unknown, I cannot set either the cell- or table- background color. So it must be done using the Label.

// set the text for the cell
NSString *row = [NSString stringWithFormat:@"%d", indexPath.row + 1];
cell.textLabel.text = [appDelegate.sharedData.dictFaves objectForKey:row];
return cell;    
}
  • 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-29T21:49:08+00:00Added an answer on May 29, 2026 at 9:49 pm

    I found the problem. I was not properly initializing and assignng the TableView in my view controller. See below

    - (void)viewDidLoad
    {
       [super viewDidLoad];
    
       tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]     style:UITableViewStylePlain];
    
       tableView.dataSource = self;
       tableView.delegate = self; 
       tableView.backgroundColor=[UIColor blackColor];
       self.view = tableView;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iPhone app consisting of a few forms in which I collect
I have a rather simple iPhone app consisting of numerous views containing a single,
I have created a MultilineCell for my app, which shows first a UILabel consisting
I have a project which has gui consisting of three buttons.Now one of these
I have one simple widget consisting in a simple button that launches the main
for example: I have app A, which references library A and library B. in
I have an app with a large ListView which is terribly slow so I'm
I have an app which could benefit from the user being able to choose
I have a web-app consisting of some html forms for maintaining some tables (SQlite,
I have a web app consisting of some JSPs that were previously running on

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.