I am trying to make a list of years based on their decade.
I have this forLoop:
for (int i = 0; i <= 9; i++) {
NSString *thisYear = [NSString stringWithFormat: @"%ld", thisDecade];
//NSLog (@"(long)selectedDecade++ %ld", (long)selectedDecade++ );
thisDecade = thisDecade ++;
NSLog (@"thisDecade %ld", thisDecade);
}
I use the result in a button label. Logging the output shows a difference between the label text and the loop results and I have a sore neck trying to figure out why.. Is it something in the loop? thanks
Logs:
[AppDelegate setYears]
selectedDecade: 1970
thisDecade 1971
RightSideBar aTitle is 1970
thisDecade 1972
RightSideBar aTitle is 1971
thisDecade 1973
RightSideBar aTitle is 1972
thisDecade 1974
RightSideBar aTitle is 1973
thisDecade 1975
UPDATE - I appreciate all the help, but I remain stumped. I'm attaching a screenshot of the logs, and the code that produces them.. Thanks again..
-(void)addButtonWithTitle:(NSString*)aTitle image:(NSImage*)image alternateImage:
(NSImage*)alternateImage
{
//NSLog(@"%s", __FUNCTION__);
NSButtonCell * cell = [self addButton];
[cell setTitle:aTitle];
NSLog(@"RightSideBar aTitle is %@", aTitle); << see the logs vs the screenshot
[cell setImage:image];
[cell setAlternateImage:alternateImage];
}
logs:
UPDATE2: It turns out that I subclassed the custom cell incorrectly, and as a result, called it too many times..I will mark as complete as you all gave me great ideas to work with.I wish we could award multiple points..