objective c - NSOutlineView crash on error EXC_BAD_ACCESS code=13 -


i have nsoutlineview custom cell named listcell. set label , icon custom cell. nsoutlineview crash on error exc_bad_access code=13. have idea, how repair it? thx reply.

- (nsinteger)outlineview:(nsoutlineview *)outlineview numberofchildrenofitem:(id)item {   return [[[datasingleton shareddata] pages] count]; }  - (bool)outlineview:(nsoutlineview *)outlineview isitemexpandable:(id)item {   return no; }  - (id)outlineview:(nsoutlineview *)outlineview objectvaluefortablecolumn:(nstablecolumn *)tablecolumn byitem:(id)item {   return item; }  - (id)outlineview:(nsoutlineview *)outlineview child:(nsinteger)index ofitem:(id)item {   listtablecellview *cell = [outlineview makeviewwithidentifier:@"listcell" owner:self];    cell.label.stringvalue = [nsstring stringwithformat:@"%ld", index + 1];   [cell.label setbackgroundcolor:[nscolor clearcolor]];    if ([self.icons objectforkey:[nsstring stringwithformat:@"%ld", index]])     [[cell icon] setimage:[self.icons objectforkey:[nsstring stringwithformat:@"%ld", index]]];    return cell; }  - (bool)outlineview:(nsoutlineview *)outlineview shouldselectitem:(id)item {  return yes; } 

these methods data source delegate methods. such should concerned handling data. doing here makes no sense me.

the view expect objects can use in table cell's setstringvalue: etc methods. giving custom cell in -outlineview:objectvaluefortablecolumn:byitem: going confuse it.

also, don't think handling counts properly. -outlineview:numberofchildrenofitem: should return count of sub items item passed in. index passed in -outlineview:child:ofitem: can anywhere between 0 , count - 1.

furthermore, think need ensure items return consistent between invocations of -reloaddata. so, if, say, view asks child 5 of item nil (nil means "root level" item) should consistently return same object each time. haven't seen documented anywhere, had similar problem once generating objects on fly.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -