Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSTableView crash!

NSTableView crash!
Thread Tools
Fresh-Faced Recruit
Join Date: Jul 2002
Location: Algarve, Portugal
Status: Offline
Reply With Quote
Apr 20, 2003, 06:28 AM
 
Hi!

I'm begining with Cocoa and I'm writing a little application that contains a NSTableView. I drawed the NSTableView in the GUI with IB (10 rows visible).

I have a class as the NSTableDataSource and aparently it works ok, filled my object with the data and set the dataSource for the TableView. When I build and run the application it fills the rows correctly and after the last visible row in the NSTableView it crashes with a Signal 11.

Any idea of what's happening?

Thanks for the help.
--
Leonel Martins
     
Senior User
Join Date: Dec 2001
Status: Offline
Reply With Quote
Apr 20, 2003, 07:28 PM
 
Um, code, please?

(I'll assume that is an array bounds problem though. Make sure you are subtracting 1 from your -[NSArray count] and NOT subtracting 1 in the appropriate places. Your data source is probably telling the NSTableView that you have one more row than you really do.)
"Think Different. Like The Rest Of Us."

iBook G4/1.2GHz | 1.25GB | 60GB | Mac OS X 10.4.2
Athlon XP 2500+/1.83GHz | 1GB PC3200 | 120GB | Windows XP
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Apr 20, 2003, 09:34 PM
 
For basic stuff this seems to work for me..
(notice no subtracting/not-subtracting)

Code:
- (int)numberOfRowsInTableView:(NSTableView *)aTableView { return [myArray count]; } - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { return [myArray objectAtIndex:rowIndex]; }
I guess I'll second the code request because we can't really figure out where you're going wrong without it.
     
Senior User
Join Date: Dec 2001
Status: Offline
Reply With Quote
Apr 20, 2003, 09:41 PM
 
Yeah, IamBob has got a point there. Due to good design on Apple's part, you don't normally need to do any adding or subtracting of 1 for data sources.
"Think Different. Like The Rest Of Us."

iBook G4/1.2GHz | 1.25GB | 60GB | Mac OS X 10.4.2
Athlon XP 2500+/1.83GHz | 1GB PC3200 | 120GB | Windows XP
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:25 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2