CellForRowAtIndexPath not called in tableView reloadData

I have a UITableView on one view that loads data at the beginning of the application, and then when the user enters text in the field and presses the button, I re-query the database, re-populate the original NSMutableArray which stores the data for the table.

It all works great. In some registration operators, I can say that the array has the correct information, the numberOfRowsInSection method returns the correct counter and is called after a reboot call.

However, cellForRowAtIndexPath is never called a second time (after a reboot), and the table data is never updated.

I spent hours searching the net and I didn’t find anything that helps. Can anyone help?

All code is located at: http://github.com/botskonet/inmyspot

A specific reboot is called at: http://github.com/botskonet/inmyspot/blob/master/Classes/InMySpotViewController.m

Sample line 94

C: http://github.com/botskonet/inmyspot/blob/master/Classes/PlateFormViewController.m

Sample line 101

A bit more information: as soon as new data has been added to mutablearray, if I try to start scrolling the table, it will eventually die with:

"The application terminated due to an unreported exception" NSRangeException ", reason:" *** - [NSCFArray objectAtIndex:]: index (29) outside (29) "

, - , , , , , , .

+2
6

. : UIViewController (MyViewController), , UITableViewController (MyTableViewController). MyViewController.xib, , tableView, MyViewController, , , MyTableViewController, Interface Builder View MyViewController MyTableViewController's view.

, Interface Builder : enter image description here

+3

, UITableView.

@interface InMySpotViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource>{
}

mainDelegate.plates :

NSMutableArray *platesArray = [[NSMutableArray alloc] init];
                mainDelegate.plates = platesArray;
                [platesArray release];

. , , . InMySpotViewController PlateFormViewController.

+1

plateLookup clobber :

    NSMutableArray *platesArray = [[NSMutableArray alloc] init];
    mainDelegate.plates = platesArray;
    [platesArray release];

. , cellForRowAtIndexPath: .

:

        InMySpotViewController *viewController = [[InMySpotViewController alloc] init]; 
        [viewController refreshTable];

, , .

+1

:

inMySpotViewController UITableViewController a UIViewController, . UIViewController, UITableView:

IBOutlet UITableView *myTblView;
@property (nonatomic, retain) UITableView *myTblView;

. , .

Array , , - , , ( , , , , ).

, , plate.count , "clobbered" .

!

+1

, tableView . , , , tableView UITableViewController. , , , UITableViewController, .

0

. google delegate. , delegate data source .

, , - :

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

:

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

But when checking this breakpoint, I found that _dataArraysomehow nothing. This method should return a positive integer, otherwise

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

cannot be called.

I hope this can be helpful.

0
source

All Articles