How to tell the amount of days from now until an NSDate?
问题 How can I tell the amount of days from now until the date specified in my app? Here is what I have so far, but it comes up with "-30" every time, no matter what the date is: NSDate * selected = [DatePicker date]; NSString * date = [selected description]; NSDateComponents *components = [[NSCalendar currentCalendar] components:NSDayCalendarUnit fromDate:DatePicker.date]; CalLabel1.text = [NSString stringWithFormat:@"%d", [components day]]; NSDateFormatter *temp = [[NSDateFormatter alloc] init];