I have an application for iPhone that gives information based on the current date. For example if the date is 10/28/13, it will say Today's weather is.... etc. How can I use an "If-Then" statement to find the current date? Or is there another better way of automatically finding the date and adjusting the display of the application?
I've tried implementing this by using a google calendar API but could't get that to work either.
Thanks a lot! This is my 2nd app ever on iOS so I need a lot of help! Thanks!
EDIT Just in case anyone needs this later on, this is what I got to finally work for me
NSDateFormatter *df= [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd"];
NSDate *date1 = [df dateFromString:@"2013-10-27"];
NSDate *date2 = [df dateFromString:@"2013-10-28"];
NSDate *currentDate = [NSDate date];
[[NSCalendar currentCalendar] rangeOfUnit:NSDayCalendarUnit startDate:&date1 interval:NULL forDate:date1];
[[NSCalendar currentCalendar] rangeOfUnit:NSDayCalendarUnit startDate:¤tDate interval:NULL forDate:currentDate];
if ([currentDate isEqualToDate:date1]) {
crowdLabel.text = [NSString stringWithFormat:@"%@", itsOk];
} else {
crowdLabel.text = [NSString stringWithFormat:@"Not Working"];
}