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

The Archive Base Latest Questions

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

I have a UITableView and the data is pulled from a database stored externally.

  • 0

I have a UITableView and the data is pulled from a database stored externally. Obviously it takes some time to fetch that data, do when the app is launched there is no data in the array which the table uses for it’s data.

When the data is loaded from the external source I call [self.tableview reloadData]; but there is a slight problem. The first cell doesn’t have any text in it until after it is redrawn, either by selecting it or by scrolling it off the screen. I’ve tried adding a call to [self.tableView setNeedsLayout]; and [self.tableView setNeedsDisplay] but this has no apparent effect.

The array contains the correct data at the time of reloading the table so it’s not a race condition thing (I believe!).

Any other ideas about what could be causing this?

@implementation EXPMasterViewController

@synthesize detailViewController = _detailViewController;
@synthesize partiesModel = _partiesModel;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
       self.title = NSLocalizedString(@"Master", @"Master");
       self.clearsSelectionOnViewWillAppear = NO;
       self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);

       self.partiesModel = [[Parties alloc] init];
       [[NSNotificationCenter defaultCenter] addObserver:self 
                                             selector:@selector(reloadData)
                                                 name:@"ReloadData" 
                                               object:nil];
    }
    return self;
}

-(void)reloadData{
    [self.tableView reloadData];
    [self.tableView setNeedsLayout];
    [self.tableView setNeedsDisplay];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
    [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0 animated:NO scrollPosition:UITableViewScrollPositionMiddle];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if(self.partiesModel.partiesArray) return [self.partiesModel.partiesArray count];
    else return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell.
    cell.textLabel.text = [[self.partiesModel.partiesArray objectAtIndex:indexPath.row] name];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (!self.detailViewController) {
        self.detailViewController = [[[EXPDetailViewController alloc] initWithNibName:@"EXPDetailViewController" bundle:nil] autorelease];
    }
    self.detailViewController.detailItem = [self.partiesModel.partiesArray objectAtIndex: indexPath.row];
}
  • 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-28T05:49:08+00:00Added an answer on May 28, 2026 at 5:49 am

    Ah fixed it, it was something to do with initially selecting a row. Removing [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0 animated:NO scrollPosition:UITableViewScrollPositionMiddle]; cleared it all up

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

Sidebar

Related Questions

I have a UITableView that collects data from a database. What I would like
I have a UITableview cell that gets a tally from a core data database.
I have a UITableView that fetches data from CoreData using FetchedResultsController and it registers
I have a UITableView that was created from data coming from a mutable array.
I have a UITableView that loads remote data from the network. I have logic
I have an UITableView that derives its data from an NSArray . In the
I have a UITableView instance tableView that displays data from a server. The tableView
I have a UITableView which loads its data from the web. It takes a
In my app I have UITableView & table data can be updated from remote
I have a UITableView that gets information from a server and publishes the data

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.