Hi, still quite a newbie to iPhone developer aso bear with me.
All I'm trying to do is display today's month and day in a label on the nib
the connections to the nib labels are ok but what am I doing wrong here?
Code:
//NSDate *today = [NSDate date];
NSDateComponents *comp = [[NSDateComponents alloc] init];
NSInteger month = [comp month];
NSInteger day = [comp day];
NSString *monthTxt;
if (month == 1) {
monthTxt = @"Jan";
} else if (month == 2) {
monthTxt = @"Feb";
} else if (month == 3) {
monthTxt = @"Mar";
} else if (month == 4) {
monthTxt = @"Apr";
} else if (month == 5) {
monthTxt = @"May";
} else if (month == 6) {
monthTxt = @"Jun";
} else if (month == 7) {
monthTxt = @"Jul";
} else if (month == 8) {
monthTxt = @"Aug";
} else if (month == 9) {
monthTxt = @"Sep";
} else if (month == 10) {
monthTxt = @"Oct";
} else if (month == 11) {
monthTxt = @"Nov";
} else if (month == 12) {
monthTxt = @"Dec";
} else {
monthTxt = @"Err";
}
[lblMonth setText:monthTxt];
[lblDay setText:[NSString stringWithFormat:@"%i",day]];
[monthTxt release];
[comp release];