I have a NSTableView which works fine except that it only shows a screen's worth of data. I've checked as it loads and all data is in the source Arrays (3 columns = 3 Mutable Arrays). All rows seem to be there but, when I scroll up (or down, depending on your viewpoint), the rows that were off-screen are blank.
I increased the height of the Table View and more data appeared but with the same effect for off-screen rows. In fact, I built the table by copying from an earlier version which works fine - and I've done a comparison of properties and can't see any differences.
Any ideas. I'm happy to add code but I'm not even sure what to show you.
To confirm build, the tableView code:
- (NSString *) returnedValue: (NSString *) keyName forRow: (NSUInteger) row
{
if( [keyName isEqualToString: Col1Id] )
{
return [actuelColDesc objectAtIndex: row];
}
else if( [keyName isEqualToString: Col2Id] )
{
return [actuelColSing objectAtIndex: row];
}
else if( [keyName isEqualToString: Col3Id] )
{
return [actuelColPlur objectAtIndex: row];
}
return nil;
}
#pragma mark - Table View Data Source
- (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView
{
return self.actuelColDesc.count;
}
- (id) tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
return [self returnedValue: tableColumn.identifier forRow: row];
}
Populating method:
- (void) doPopulateTable:exportedTable withTitle: (NSString *) titleString andWord: (NSString *) reportedWord sizingFlag: (NSUInteger) sFlag
{
NSUInteger size1, size2, size3;
NSRect tableFrame;
currentVoice = 1;
noOfArrays = [exportedTable count];
if( noOfArrays > 6 )
{
switch (currentVoice)
{
case 1:
actuelColDesc = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:0]];
actuelColSing = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:1]];
actuelColPlur = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:2]];
reportParseSing = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:7]];
reportParsePlur = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:8]];
break;
case 2:
actuelColDesc = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:0]];
actuelColSing = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:3]];
actuelColPlur = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:4]];
reportParseSing = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:9]];
reportParsePlur = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:10]];
break;
case 3:
actuelColDesc = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:0]];
actuelColSing = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:5]];
actuelColPlur = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:6]];
reportParseSing = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:11]];
reportParsePlur = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:12]];
break;
default:
break;
}
}
else
{
actuelColDesc = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:0]];
actuelColSing = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:1]];
actuelColPlur = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:2]];
reportParseSing = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:3]];
reportParsePlur = [[NSMutableArray alloc] initWithArray:[exportedTable objectAtIndex:4]];
}
if( noOfArrays == 14 )
{
[btnBaseMiddle setHidden:NO];
[btnBasePassive setHidden:NO];
}
[reportTable reloadData];
if( sFlag == 2 )
{
size1 = 686;
size2 = 644;
size3 = 320;
}
else
{
size1 = 524;
size2 = 474;
size3 = 150;
}
tableFrame = [[self window] frame];
tableFrame.size.width = size1;
[[self window] setFrame:tableFrame display:YES];
tableFrame = [[self reportTable] frame];
tableFrame.size.width = size2;
[[self reportTable] setFrame:tableFrame];
[[self column1] setWidth:size3];
[[self window] setTitle:[NSString stringWithString:titleString]];
}
(The run that I'm using for debug has 107 rows - i.e. the arrays each have 107 objects.)
Properties of the TableView include the following: View Based, Floats Group Rows (YES), Trancates Last Visible Line (NO), State Enabled (YES), Autoresizes Subviews (YES).
numberOfRowsInTableViewand @"Test" inobjectValueForTableColumn? Do you get any empty cells? - koen