objective c - Obj-c/cocoa: When I click a button, an infinite loop starts, data appears corrupted? -


question posted here: http://www.daniweb.com/software-development/objective-c/threads/453854/nstableview-is-not-updating-correctly has full code.

gui:

i'm using nsmutablearray store strings populate nstableview on form. using button action delete specified row. rows specified value stored in int, updates when click on table.

when click button on form activates method:

-(ibaction)removefromlist:(id)sender {     nslog(@"count: %d, at: %d\n",count,at);     if(at<count)     {           [list removeobjectatindex:at];     }     [_table reloaddata];     at=count+1;     count--;     [_label setstringvalue:[self converttonsstring:at]]; } 

table points table, removefromlist called remove, int @ specifies row removed, list nsmutablearray, count total number of rows. _label points label @ bottom of screen, tells me @ pointing to. following output:

2013-05-04 02:32:17.874 todolist[571:903] count: 7, at: 2 2013-05-04 02:32:34.763 todolist[571:903] *** -[nscfarray objectatindex:]: index (6) beyond bounds (6) 

last line repeats on , on. don't know whats going on here or should at. can tell thats part of project doesn't work. or should looking @ appreciated.

you're not decrementing count variable after remove object list, numberofrowsintableview: still return old value, tableview:objectvaluefortablecolumn:row: called row no longer exists in array.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -