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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:32:46+00:00 2026-06-19T01:32:46+00:00

I have a problem with refreshing the content of a UITableView . I’m trying

  • 0

I have a problem with refreshing the content of a UITableView. I’m trying to display a list of members in a UITableView. Above this list I have some kind of dropdown-menu for a group selection. So, if I change the group, selected in the dropdown-menu, I want to change the content of the UITableView underneath it. It’s actually not working correctly.
The first time I load the ViewController that contains the UITableView, it shows the correct list of members in the default group. Now, when I change the group, it should display my new list of members, but it doesn’t. It seems that the UITableView would not even reload its table content.
Here is my code for the TableViewController:

MemberTableViewController.m

- (void)viewDidLoad {
  [super viewDidLoad];

  self.members = [NSMutableArray new];
  self.selectedRows = [NSMutableArray new];
  self.groupManager = [GroupManager new];

  int *number;
  if (nil != [self gruppeId]) {
      number = [[self gruppeId] intValue]; // Here will be the id of the new selected group
  } else {
    number = 4010292; // This is just for testing. It's the id of my default group
  }

  for (Group *group in [self.groupManager findGroupWithID:[NSNumber numberWithInt:number]]) {

    for (Member *member in group.member) {
        [self.members addObject:member];
    }
  }

  NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES selector:@selector(caseInsensitiveCompare:)];
  [self.gruppenMitglieder sortUsingDescriptors:[NSArray arrayWithObject:sort]];
  [self.tableView setAllowsMultipleSelection:YES];
  [self.tableView reloadData];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return  [[self members] count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    GreenTexturedCell *cell = nil;
    Member *member = [self members][indexPath.row];
    NSArray* views = [[NSBundle mainBundle] loadNibNamed:@"GreenTexturedCell" owner:nil    options:nil];

    for (UIView *view in views) {
        if([view isKindOfClass:[UITableViewCell class]]) {
            cell = (GreenTexturedCell*)view;
        }
    }


    cell.textLabel.text = member.name;
    cell.textLabel.font = [UIFont fontWithName:@"JandaCloserToFree" size:14.0];
    cell.textLabel.textColor = [UIColor whiteColor];

    return cell;
}

Now I have another ViewController the MemberListViewController, it contains the MemberTableViewController (I know, the naming is not the best…). The MemberListViewController implements a protocol of the GroupSelectionTableViewController. Its delegate function will be called when the selected group changes. Here is the code for the MemberListViewController:
MemberListViewController.h

@interface MemberListViewController : UIViewController <GroupSelectionDelegate>
@property (weak, nonatomic) IBOutlet UIButton *groupSelection;
@property (nonatomic, strong) GroupSelectionTableViewController *groupTableView;
- (IBAction)groupSelectionPressed:(id)sender;
@end

MemberListViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setGroupTableView:[GroupSelectionTableViewController new]];
    [[self groupTableView] setDelegate:self];
}

- (IBAction)gruppeAuswahlPressed:(id)sender {

    if ([self groupListShown]) {
        [[[self groupTableView] view] removeFromSuperview];
        [self setGroupListShown:NO];
    } else {
        [self.view addSubview:[[self groupTableView] view]];
        [self setGroupListShown:YES];
    }
}

- (void) groupSelectionController:(GroupSelectionTableViewController *)groupSelection DidSelectGroupWithId:(NSString *) groupId {
    [[self groupSelection] setTitle:name forState:UIControlStateNormal];
    [[[self groupTableView] view] removeFromSuperview];
    [self setGroupListShown:NO];
    MemberTableViewController *memberTableView = [self.storyboard instantiateViewControllerWithIdentifier:@"memberTable"];
    [memberTableView setGroupId:[NSNumber numberWithInt:4017411]]; // Id for testing
    [memberTableView refreshControl];

}

Now, if I change the group selection, the -groupSelectionController:DidSelectGroupWithId: Method is called and with [memberTableView refreshControl] I’m able to get into the viewDidLoad Method of the MemberTableViewController again and set the groupId to my testing id. Now i want the TableView to reload its content to get the members of the selected group. With the statement [self.tableView reloadData] I’m getting into the tableView:NumberOfRowsInSection: Method but not into the tableView:CellForRowAtIndexPath: Method and the TableView Content is not redrawn.

What am I doing wrong ?
This problem is driving me nuts, so I hope there’s someone to help me out.
Thanks

  • 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-19T01:32:47+00:00Added an answer on June 19, 2026 at 1:32 am

    With instantiateViewControllerWithIdentifier you are creating a new instance of MemberTableViewController, which isn’t the one you are showing on screen. Hence, you won’t see the changes which should be shown by calling reloadData.

    To be able to reload the table data, you can add a link to the table at your MemberListViewController. Change the code of the .h to:

    #import "MemberTableViewController.h"
    @interface MemberListViewController : UIViewController <GroupSelectionDelegate>
    {
        IBOutlet MemberTableViewController *memberTableView;
    }
    @property (weak, nonatomic) IBOutlet UIButton *groupSelection;
    @property (nonatomic, strong) GroupSelectionTableViewController *groupTableView;
    - (IBAction)groupSelectionPressed:(id)sender;
    @end
    

    and then, in the .m, you can call [memberTableView reloadData];

    Do not forget to set memberTableView as “new referencing outlet” within the storyboard file.

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

Sidebar

Related Questions

I have a small problem. So I have this page that loads dynamic content
I have a problem refreshing a ListView. I call my ListView Activity , I
I'm using EJB3 and I have a problem related to refreshing my EntityManager .
I have problem with my query on C, I’m using the oci8 driver. This
I have a problem refreshing a partial with fields_for inside. Here is the code
I have two problems I am trying to solve, one is refreshing the tab
I have got a strange problem.This is my code: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML
I'm using this method to display different content based on the variable that was
I have a problem with updating/refreshing data in table. I am using DefaultTableModel. Here
I'm refreshing my PHP knowledge and have a problem I can't solve on my

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.