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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:51:24+00:00 2026-06-15T16:51:24+00:00

I’ve working on a program and I’m having issues getting a tableView to update.

  • 0

I’ve working on a program and I’m having issues getting a tableView to update. Pretty much I have an tableView and there is nothing but empty rows at first. Then the user hits the + sign and I PUSH a new tableview on top of the stack and the user can select from a master list of which rows they want to add to the initial table. The rows that the user picks are added to an array. When the user clicks the back button, the first table doesn’t update. However, if I press the HOME key and then reload the app, the first table view displays the updated array. I have included the code from both tables and my gloabl array.

.m File for first table

@interface baseTableViewViewController ()

@end

@implementation baseTableViewViewController

//@synthesize tableView = _tableView;

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

    }
    return self; }

- (void)viewDidLoad {
    [super viewDidLoad];

     }

-(void)viewDidlAppear:(BOOL)animated{



}

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


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

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{


    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"base"];

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

    BaseInfo *infoAtIndex = [[[DataClass getInstance] allItems] objectAtIndex:[indexPath row]];

    [[cell textLabel] setText:[infoAtIndex name]];
    [[cell detailTextLabel] setText:[infoAtIndex icao]];
    return cell; }

-(void)awakeFromNib{
    [super awakeFromNib]; }

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

@end

.h file for first table



@class baseTableViewViewController; @class BaseInfoDataController;

@interface baseTableViewViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, retain) UITableView *tableView;


@end

.m file for second table (the master list)

@class BaseInfo; @interface MasterListTableViewController ()


@end

@implementation MasterListTableViewController @synthesize delegate;


- (id)initWithStyle:(UITableViewStyle)style {
    self = [super initWithStyle:style];
    if (self) {

    }
    return self; }

- (void)viewDidLoad {
    [super viewDidLoad];   }


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



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

    return [self.dataController countOfList]; }

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

    }

    BaseInfo *infoAtIndex = [self.dataController objectInListAtIndex:indexPath.row];
    [[cell textLabel] setText:infoAtIndex.name];
    [[cell detailTextLabel] setText:infoAtIndex.icao];

    return cell; }




- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];

    NSMutableArray *addBaseList = [[NSMutableArray alloc]init];
    self.masterList = addBaseList;
    BaseInfo *inform;


    if ([selectedCell accessoryType] == UITableViewCellAccessoryNone){
        [selectedCell setAccessoryType:UITableViewCellAccessoryCheckmark];

        inform = [self.dataController objectInListAtIndex:indexPath.row];
        NSLog(@"%@",inform.name);
        NSLog(@"%@",inform.icao);

        [DataClass.getInstance addObject:inform];




    }else{
        [selectedCell setAccessoryType:UITableViewCellAccessoryNone];

    }

    [tableView deselectRowAtIndexPath:indexPath animated:NO];
     }

-(void)awakeFromNib{
    [super awakeFromNib];
    self.dataController = [[MasterListDataController alloc]init]; }

-(IBAction)cancel:(id)sender{

    [self masterListTableViewControllerDidCancel:self];

}

-(IBAction)done:(id)sender{

    [self masterListTableViewControllerDidSave:self]; }


-(void)masterListTableViewControllerDidCancel:(MasterListTableViewController
*)controller{

    [self dismissViewControllerAnimated:YES completion:nil]; }



-(void)masterListTableViewControllerDidSave:(MasterListTableViewController
*)controller{

    [self dismissViewControllerAnimated:YES completion:nil]; }


@end

below is the .h for the second table

@class MasterListTableViewController; @class BaseInfo;




@interface MasterListTableViewController : UITableViewController

@property (nonatomic, assign) id delegate; @property (nonatomic, copy) NSMutableArray *masterList; @property (nonatomic, retain) NSArray
*baseNames; @property (nonatomic, retain) NSArray *icao; @property (strong, nonatomic) MasterListDataController *dataController; @property (nonatomic, copy)BaseInfo *inform;


- (IBAction)cancel:(id)sender;
- (IBAction)done:(id)sender;

-(void)masterListTableViewControllerDidCancel:(MasterListTableViewController
*)controller;
-(void)masterListTableViewControllerDidsave:(MasterListTableViewController
*)controller;

@end

and finally the global array that i’m using with the methods

@implementation DataClass @synthesize userBaseList;

+(DataClass *)getInstance{
    static DataClass *instance = nil;
    //@synchronized(self)
    {
        //if(instance ==nil)
        if(!instance)
        {
            //instance = [DataClass new];
            instance = [[super allocWithZone:nil]init];
        }
    }
    return instance; }

-(void)addObject:(BaseInfo*)info{
    [self.userBaseList addObject:info];
     }
-(void)removeObjectAtIndex:(NSInteger)atIndex{
    [self.userBaseList removeObjectAtIndex:atIndex]; }

+(id)allocWithZone:(NSZone *)zone{
    return [self getInstance]; }
-(id)init{
    self = [super init];
    if (self){
        userBaseList = [[NSMutableArray alloc]init];
    }
    return self; }
-(NSArray *)allItems{
    return userBaseList; } @end

I think the solution has to be something very simple that I’m missing, but I just don’t see it. I’ve read through the apple developers guide for uitableview development, but I’m still stuck.

  • 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-15T16:51:26+00:00Added an answer on June 15, 2026 at 4:51 pm

    changed table 1.h to the following:

    @class baseTableViewViewController; @class BaseInfoDataController;
    
    @interface baseTableViewViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource>
    
    @property (nonatomic, retain) UITableView *tableView;
    
    
    @end
    

    I had to define it as a UITableViewController instead of a UIViewController. Once I corrected this, it refreshed the list.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,

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.