Re: NSTableView
Re: NSTableView
- Subject: Re: NSTableView
- From: Graham Cox <email@hidden>
- Date: Wed, 5 Nov 2008 15:50:53 +1100
On 4 Nov 2008, at 10:13 pm, Mahaboob wrote:
content = [[[[[tableView
tableColumnWithIdentifier:@"MediaType"] dataCellForRow:i]stringValue]
stringByAppendingString:@","]
stringByAppendingString:[[[tableView
tableColumnWithIdentifier:@"Category"]
dataCellForRow:i]stringValue]] ;
Ouch.
Why don't you split this out into separate lines so you can see what's
going on? There is no advantage to cramming everything into one line -
it's merely less readable and no faster. You'll then be able to debug
it line by line and see where things are not as you expect.
I suspect something's returning nil in the middle of this lot and so
breaking the gradual accumulation of strings. This code assumes it
will never do that which isn't a good assumption. Since -
stringByAppendingString: returns a new string each time, you are also
making a lot of redundant temporary objects. That might not be a
problem, but why do it when you don't have to?
for(i=0;i<[tableView numberOfRows];i++)
From the docs:
"Typically you should not ask the table view how many rows it has;
instead you should interrogate the table view's data source."
How can I access all selected row values?
It's easy to iterate over the selection, just get -selectedRowIndexes
and enumerate the index set returned.
hth, Graham
_______________________________________________
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
References: | |
| >NSTableView (From: Mahaboob <email@hidden>) |