Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lg3

macrumors newbie
Original poster
Apr 16, 2012
6
0
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?

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:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.