Inserting a new column in an NSMatrix
Inserting a new column in an NSMatrix
- Subject: Inserting a new column in an NSMatrix
- From: Arthur VIGAN <email@hidden>
- Date: Fri, 12 Dec 2003 19:58:09 +0100
Hi,
I have the following code to insert a new colum of custom NSCells in an
NSMatrix, but it dosn't work properly:
- (void)insertCells
{
NSMutableArray *cellsArray = [[NSMutableArray alloc] init];
int i;
for(i = 0; i < nbrCells; i++)
{
TransparentButtonCell *tempCell = [[TransparentButtonCell
alloc] init];
[cellsArray addObject:tempCell];
}
[theMatrix setFrame:NSMakeRect(0.0, 0.0, [scrollView
contentSize].width, 3 * 30.0)];
[theMatrix addColumnWithCells:cellsArray];
[cellsArray release];
}
When I run the code, I get this on the console:
2003-12-12 19:55:05.593 Test[2623] *** Assertion failure in -[NSMatrix
insertColumn:withCells:], AppKit.subproj/NSMatrix.m:1338
2003-12-12 19:55:05.593 Test[2623] An uncaught exception was raised
2003-12-12 19:55:05.594 Test[2623] Invalid parameter not satisfying:
!newCells || ([newCells count] == _numRows)
2003-12-12 19:55:05.594 Test[2623] *** Uncaught exception:
<NSInternalInconsistencyException> Invalid parameter not satisfying:
!newCells || ([newCells count] == _numRows)
When this part of the code is run, the matrix has already been inited,
but is empty:
theMatrix = [[NSMatrix alloc] initWithFrame:NSMakeRect(0.0, 0.0,
[scrollView contentSize].width, 0 * cellSize)
mode:NSHighlightModeMatrix
cellClass:[TransparentButtonCell class]
numberOfRows:0
numberOfColumns:1];
Can someone tell me what's wrong with this code?
Thanks a lot in advance,
-- Arthur
--
Arthur VIGAN
AstroK Software
http://perso.wanadoo.fr/vigan/aksoft/index.html
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.