• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTableHeaderView shifting after scrolling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableHeaderView shifting after scrolling


  • Subject: NSTableHeaderView shifting after scrolling
  • From: email@hidden
  • Date: Fri, 18 Jul 2008 19:28:16 +0000

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@hidden)

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:

This email sent to email@hidden

  • Prev by Date: Re: NSMutableDictionary autorelease chrashes application
  • Next by Date: Re: Inverse Regex Library?
  • Previous by thread: assertion failure in AppKit
  • Next by thread: NSTableHeaderView shifting after scrolling
  • Index(es):
    • Date
    • Thread