Re: Cocoa-dev Digest, Vol 3, Issue 675
Re: Cocoa-dev Digest, Vol 3, Issue 675
- Subject: Re: Cocoa-dev Digest, Vol 3, Issue 675
- From: Theodore Petrosky <email@hidden>
- Date: Sun, 21 May 2006 06:53:56 -0700 (PDT)
>
>
> >i'll assume next that your using Interface Builder
(IB) to create your
> window and tableview
> >and that you have setup the connections between
your TableController
> and
> the tableView there
>
> that's right.
>
> Since your last mail I updated many things : I
suppressed the
> TableController class and did everything
> in the MyDocument class. Now I've got a different
problem :
> - the Console tells me I've used an ``out of bounds"
index in some
> array.
> - the debugger tells me more precisely when it
occurs :
>
> at some invocation of the ``updateUI" method, the
command [table1
> reloadData] is called
> then comes the method
> tableView:(NSTableView *)aTableView
objectValueForTableColumn(...),
> which
> I defined as follows :
>
> - (id)tableView:(NSTableView *)aTableView
> objectValueForTableColumn:(NSTableColumn
*)aTableColumn
> row:(int)rowIndex
> {
>
> if (aTableView==table1) {
> return [array1 objectAtIndex: rowIndex];
> }
> if (aTableView==table2) {
> return [array2 objectAtIndex: rowIndex];
> }
> }
>
> I checked that the indexes are correct (array1 and
array2 have length
> 1
> and rowIndex is 0).
> When I continue with the ``step over" instruction in
the debugger, it
> leaves
> the function above and goes into an esoteric file
(here's a sample )
set the table column identifier in IB to be the same
name as the object in your array
Yes almost, you are forgetting to tell -(id)
tableView... which column....
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn
*)aTableColumn
row:(int)rowIndex {
id theRecord, theValue;
if (aTableView==table1) {
NSParameterAssert(rowIndex >= 0 && rowIndex <
[records count]);
theRecord = [array1 objectAtIndex:rowIndex];
theValue = [theRecord objectForKey:[aTableColumn
identifier]];
return theValue;
}
}
Ted
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden