I'm working on a program for 10.8 using ARC so there's no retain/release going on.
What I'll describe is not exactly what I'm doing but will illustrate the problem. I have a Person class with 3 dates, say birthday, graduation and wedding. What I'd like to do is have that Person listed in an outline view With their name as the group and you click the disclosure triangle to get Birthday: 1/2/70, Graduation: 2/3/88, etc.
Initially in
I would return, for instance,
However, after
displayed that item, the string was being released and the program would crash with EXC_BAD_ACCESS.
Alternately I could return the date in
but how would I know what date it was in
?
The workaround I currently have is to have an NSMutableArray, put the string in there and then return it. The Array basically ups the retain count, it doesn't get released, all works well. But it's kind of an ugly workaround. Does anyone have any suggestions for a more elegant solution?
What I'll describe is not exactly what I'm doing but will illustrate the problem. I have a Person class with 3 dates, say birthday, graduation and wedding. What I'd like to do is have that Person listed in an outline view With their name as the group and you click the disclosure triangle to get Birthday: 1/2/70, Graduation: 2/3/88, etc.
Initially in
Code:
outlineView:child:ofItem:
Code:
[NSString stringWithFormat: @"Birthday: %@", [person birthday]];
Code:
outlineView:objectValueForTableColumn:byItem:
Alternately I could return the date in
Code:
outlineView:child:ofItem:
Code:
outlineView:objectValueForTableColumn:byItem:
The workaround I currently have is to have an NSMutableArray, put the string in there and then return it. The Array basically ups the retain count, it doesn't get released, all works well. But it's kind of an ugly workaround. Does anyone have any suggestions for a more elegant solution?