I am reading a csv file into a dictionary and I display the data in a
NSTableview. I created my window in Interface builder and added a NSTableview
with one column. Depending on the needs of the csv file, I add columns to the
table. Here is the code:
-(void) awakeFromNib
{
NSTableColumn* firstColumn=[theTableView
tableColumnWithIdentifier:@"1"];
[theTableView removeTableColumn:firstColumn];
int columns=[dataSource noOfColumns];
if (columns>0)
{
int counter=0;
while(counter<columns)
{
NSString* colName=[NSString
stringWithFormat:@"%i",(counter+1)];
NSTableColumn* newColumn=[[NSTableColumn
alloc]initWithIdentifier:colName];
[newColumn setEditable:NO];
[newColumn
setResizingMask:NSTableColumnNoResizing];
[[newColumn headerCell]setStringValue:colName];
[[newColumn
dataCell]setAlignment:NSRightTextAlignment];
[theTableView addTableColumn:newColumn];
[newColumn release];
counter++;
}
}
[theTableView setDataSource:dataSource];
[theTableView setNeedsDisplay:YES];
[theTableView reloadData];
}
The table displays fine and the data is presented correctly. However when I
scroll, the tableheaderview is shifted over to the right and no longer aligns
with the columns. This problem is corrected when I call:
[[aTableView headerView] setFrameOrigin:NSZeroPoint];
Any ideas about what I am doing wrong? If this is a bug with cocoa, when would
be the time to call
[[aTableView headerView] setFrameOrigin:NSZeroPoint];
so that my table always looks nice?
Thanks
Sarven
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]