I am trying to set up an email picker that will have the subject of the message be "tonight", "tomorrow","today", or it defaults to "later"
This is what I have so far. How can I get the tonight and today to show?
This is what I have so far. How can I get the tonight and today to show?
Code:
int timeZoneDifference;
NSDate *tomorrowsDate = [NSDate dateTomorrow];
NSTimeZone* timeZone = [NSTimeZone systemTimeZone];
timeZoneDifference = [timeZone secondsFromGMT];
NSDate *startDate = [ _event.startDate dateByAddingTimeInterval:timeZoneDifference];
if ([startDate isEqualToDateIgnoringTime:tomorrowsDate])
{
NSLog(@"title is tomorrow");
[controller setSubject:[NSString stringWithFormat:@"Tomorrow - %@", _event.name]];
}
else if (startDate.hour > timeZoneDifference) {
NSLog(@"title is Today");
[controller setSubject:[NSString stringWithFormat:@"Today - %@", _event.name]];
}
else if (startDate.hour <= timeZoneDifference) {
NSLog(@"title is Tonight");
[controller setSubject:[NSString stringWithFormat:@"Tonight - %@", _event.name]];
}
else {
NSLog(@"title is Later");
[controller setSubject:[NSString stringWithFormat:@" - %@", _event.name]];
}
Last edited: