CellForRowAtIndexPath is not called sometimes after calling numberOfRowsInSection when calling reloadData

I have a simple application where I have a table view and depending on the callback with the array, I reload the table data using the method reloadData. Initially, during the first 5-10 times of loading, this kind of table works without problems. After playing with the application, sometimes I noticed that the table view is empty due to the reason why cellForRowAtIndexPathit is not called by the infrastructure. I checked that datasourceboth are delegateset correctly, and numberOfRowsInSectionreturns a real positive number. When I see an empty table view, I see this empty view several times until I exit the application. I do not receive any errors or warnings in the console. I tried tuning the array, but to no avail.

Here is the code:

- (void)notifyArrayLoaded:(NSArray *)arr {
    NSUInteger capacity = [arr count];
    _tbDataArray = [[NSMutableArray alloc] initWithCapacity:capacity];

    // _tbDataArray is filled with the data from arr

    // Reload the table data
    [_tableView reloadData]; 
}

Any hint would be much appreciated.

Thanks in advance. Sumit

, DeanWombourne, viewDidUnLoad, viewWillDisAppear, .

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait;
    [[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
    [self.navigationController setNavigationBarHidden:NO animated:NO];

    UIWindow *window = [[UIApplication sharedApplication] keyWindow];
    UIView *view = [window.subviews objectAtIndex:0];

    view.transform = CGAffineTransformIdentity;
    view.transform = CGAffineTransformMakeRotation(0);
    view.bounds = CGRectMake(0.0, 0.0, 320, 480);
}

tableView, .

[numberOfSectionsInTableView:] [Line 223] <UITableView: 0xa5fc00; frame = (0 0; 320 0); clipsToBounds = YES; layer = <CALayer: 0x4830b0>; contentOffset: {0, 0}>
[tableView:numberOfRowsInSection:] [Line 229] <UITableView: 0xa5fc00; frame = (0 0; 320 0); clipsToBounds = YES; layer = <CALayer: 0x4830b0>; contentOffset: {0, 0}>
<UITableView: 0xa5fc00; frame = (0 0; 320 0); clipsToBounds = YES; layer = <CALayer: 0x4830b0>; contentOffset: {0, 0}>
[numberOfSectionsInTableView:] [Line 223] <UITableView: 0xa5fc00; frame = (0 0; 320 0); clipsToBounds = YES; layer = <CALayer: 0x4830b0>; contentOffset: {0, 0}>
[tableView:numberOfRowsInSection:] [Line 229] <UITableView: 0xa5fc00; frame = (0 0; 320 0); clipsToBounds = YES; layer = <CALayer: 0x4830b0>; contentOffset: {0, 0}>
+5
5

, reloadData . performSelectorInBackground reloadData , - :

[tableViewController reloadData]

,

[tableViewController performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]
+10

reloadData numberOfRowsInSection, cellForRowAtIndexPath, , UITableView, reloadData, UITableView, ,

NSLog(@"Calling reloadData on %@", self.tableView);
[self.tableView reloadData];

, , UITableViews. , ...

+5

viewcontroller (IBOutlet) tableView. ttb

0

, . .

, " " .

1. - ( ) 2. , () 3.poped .

, 2 3 , , . , , - . , , , . , - (UI), .

0

. , , ( ) viewDidLoad, NSSortDescriptor.

( ) View . , , .

: , , ​​ NSSortDescriptor, !

0

All Articles