Skip to main content

Posts

Showing posts with the label nsdate

how to split strings in objective c

How to split a string in objective-C? I am working on an short application that contains a date picker. I do display date get it from date picker and display it through a label. My main question is that how can I split the the date in to three separate strings? any one has idea about it? thanks Muhammad Naveed

iPhone: Notification Center Trouble

I wrote an app that allows the user to enter data in a UITextField, and one of them allows them to enter in a specific date. I'm trying to have an alert appear in the iPhones Notification Center when the date is 15 hours away, even when the app is not running at all. EDIT: New code- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UILocalNotification *localNotif = [[UILocalNotification alloc] init]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"MMdd"]; NSDate *eventDate=[dateFormatter dateFromString:eventDateField.text]; localNotif.fireDate = [eventDate dateByAddingTimeInterval:-15*60*60]; localNotif.timeZone = [NSTimeZone defaultTimeZone]; localNotif.alertBody = @"Event Tomorrow!"; localNotif.alertAction = @"Show me"; localNotif.soundName = UILocalNotificationDefaultSoundName; localNotif.applicationIconBadgeNumber = 0; [[UIApplication