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

The Archive Base Latest Questions

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

I have a UITableView with static cell that contains another UITableView which is not

  • 0

I have a UITableView with static cell that contains another UITableView which is not being updated when I call reloadData. Using ios5.

When I run the code below, the subViewTable displays the values defined in the viewDidLoad and does not update after the AFNetwork request.

Based on the NSLog output, cellForRowAtIndexPath is not being called after I call reloadData in the success block of my AFNetwork request.

My code is below

MainViewController.h

#import <UIKit/UIKit.h>
#import "SubViewTableViewController.h"

@interface MainController : UITableViewController{
  SubviewTableViewController *subViewTVC;
  IBOutlet UITableView *subViewTable;
}

MainViewController.m

@import "SubViewTableViewController.h"

@implementation MainController

- (void)viewDidLoad
{
  [super viewDidLoad];
  if (subViewTableViewController == nil)
  {
    subViewTVC = [[SubViewTableViewController alloc] init];
  }
  [subViewTable setDataSource: subViewTVC];
  [subViewTable setDelegate: subViewTVC];
  subViewTableViewController.view = subViewTableViewController.tableView;
 }

@end

SubViewTableController.h

#import <UIKit/UIKit.h>

@interface SubViewTableController : UITableViewController <UITableViewDataSource, UITableViewDelegate>{
  NSMutableArray *data;
}

@end

SubViewTableController.m

#import "SubViewTableController.h"
#import "AFNetworking.h"

@implementation SubViewTableController

- (void)fetchCustomData
{
  request = // Set NSM mutable request;
  AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest: request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {

    // Omitted code that adds JSON objects to data array 

    [self.tableView performSelectorOnMainThread:@selector(reloadData)                                withObject:nil waitUntilDone:NO];
  }
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {};
  [operation start];
} 

- (void)viewDidLoad
{
  [super viewDidLoad];
  if (data == nil)
  {
    data = [NSMutuableArray arrayWithObjects:@"1",@"2", nil];
  }
  [self fetchCustomData];
}

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

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  static NSString *CellIdentifier = @"DataCell";
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  // Configure the cell...
  if (cell == nil){
      cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  }
  cell.textLabel.text = [data objectAtIndex:indexPath.row];
  NSLog(@"Cell item: %@", [data objectAtIndex:indexPath.row]);
  return cell;
}

@end

NSLog Output

2012-12-16 13:59:31.538 testing[37592:f803] Data Count: 2
2012-12-16 13:59:31.539 testing[37592:f803] Cell item: 1
2012-12-16 13:59:31.541 testing[37592:f803] Cell item: 2
2012-12-16 13:59:31.575 testing[37592:f803] Data Count: 6
  • 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-16T09:01:14+00:00Added an answer on June 16, 2026 at 9:01 am

    I ended up sending a notification from my SubView to my MainView from the success callback of AFJSONRequestOperation which triggered [subViewTable reloadData].

    SubViewTableController.m AFJSONRequestOperation success callback:

    {
    [[NSNotificationCenter defaultCenter] postNotificationName:@"SubViewUpdated" object:nil];
    }
    

    MainViewController.m

    - (void)viewDidLoad
    {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(subViewUpdated) name:@"SubViewUpdated" object:nil];
    }
    
    - (void)subViewUpdated
    {
       [subViewTable reloadData];
    }
    
    - (void)viewDidUnload
    {
      //Unregister notifications
      [[NSNotificationCenter defaultCenter] removeObserver:self];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITableView made of static cells, and each cell contains a UILabel
on my tableview i have the last cell that is not initially visible as
I have found that the first time a UITableView loads, it does not respond
I have a UITableview cell that gets a tally from a core data database.
Thanks for the help. I have a custom cell that I expand using the
I have a UITableView that I want updated by a method called by a
I have one iphone application in which i am adding uitableview inside uitableviewcell.in that
I have a UITableView that is being populated from an NSMutable array that has
I have a table that displays cell using UITableViewCellStyleSubtitle: ============================================================= Title:This is the title
I have a UITableView with static cells and I am trying to change the

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.