I am currently trying to populate a UITable view from a plastic downloaded from the Internet. Plist loads into an NSMutableArray and is then saved as a file, which works fine.
While trying to populate my UITableView with it, I run into trouble
UITableView only displays 8 entries before the * plist file (but it has 98) And by then through them the edge reaches up to 98, so instead of 98 different parts, there are 8 entries as always.
This is my log:
2010-07-20 15: 50: 1 9.064 My customers [15221: 207] New cell 2010-07-20 15:50 : 19.065 My Customers [15221: 207] Bob 2010-07-20 15: 50: 19.68 My Clients [15221: 207] New Cell 2010-07-20 15: 50: 19.06 9 My Customers [ 15221: 207] 2010-07-20 15: 50: 19.71 my customers [15221: 207] New Cell 2010-07-20 15:50 50: 09.071 My customers [15221: 207] Neil 2010- 07-20 15: 50: 1 9.075 My Customers [15221: 207] New Cell 2010-07-20 15: 50: 19.075 My Clients [15221: 207] Robert 2010-07-20 15:50:50 .077 My Customers [15221: 207] New Cell 2010-07-20 15: 50: 19.7787 My Clients [15221: 207] Jack 2010-07-20 15: 50: 19.09 7 My Customers [15221: 207] New Cell 2010-07-20 15: 50: 19.88 MYCustomers [15221: 207] John 2010-07-20 15: 50: 19.081 My Customers [15221: 207] New Sale 2010- 07-20 15: 50: 19.82 My Customers [15221: 207] Ralph 2010-07-20 15: 50: 19.83 My Clients [15221: 207] New Cell 2010-07-20 15: 50: 19.88 My Clients [15221: 207] Bart This creates new cells, but then closes at 8 more loops. Here is how I will create cells and get the data of the array:
if (tableView == myTable) {static NSString * CellIdentifier = @ " Cell "; UITableViewCell * cell = [tableview] dequeueReusableCellWithIdentifier: CellIdentifier]; If (cell == blue) {cell = [[[UITBAL viacal light] intimateframe: CGRXres reiindifiers: cell identifiers] Autoreques]; If (indexPath.section == 0) {cell.textLabel.text = [self.dataForTable objectItindex: indexPath.row]; NSLog (@ "new cell"); NSLog (@ "% @", [Autocomplete ObjectAutlook Index: IndexPath.ro]); }} Return Cell; } NSMutableArray "dataForTable" is created like this:
if ([[NSMutableArray alloc] initWithContentsOfFile: fullFileName] autorelease] = zero) {Self .dataForTable = [[[NSMutableArray alloc] initWithContentsOfFile: fullFileName] autorelease]; } And {self.dataForTable = [[NSMutableArray alloc] init]; // Create an brand new array if there is no entry file. } The data is corrected in the array, I have checked it in log and all 98 entries are shown there, but the table view will use only 8.
I am unable to find a solution for this, can someone help me?
Thank you!
In your cellForRowAtIndexPath: method when you set it to your cell only when you create a new instance of it Are there. While UITableView reuses cells for rows (i.e. used for rows that appear to the cells for pseudo-rows) and each time you need to set up the cell for your line - so you should change your code. :
... static NSString * CellIdentifier = @ "cell"; UITableViewCell * cell = [tableview] dequeueReusableCellWithIdentifier: CellIdentifier]; If (cell == blue) {cell = [[[UITBAL viacal light] intimateframe: CGRXres reiindifiers: cell identifiers] Autoreques]; } If (indexPath.section == 0) {cell.textLabel.text = [self.dataForTable objectAtIndex: indexPath.row]; NSLog (@ "new cell"); NSLog (@ "% @", [Autocomplete ObjectAutlook Index: IndexPath.ro]); } Return cell;
Comments
Post a Comment