Delegates doesnot work properly
Posted
by Warrior
on Stack Overflow
See other posts from Stack Overflow
or by Warrior
Published on 2010-04-21T13:18:28Z
Indexed on
2010/04/21
13:33 UTC
Read the original article
Hit count: 226
I am new to iphone development.I am covering the date to the desired format and set it to the delegates and get its value in the another view.The session restarts when i tried to get the value from delegates.If i set the original date and not the formatted date in the set delegate ,then i able to get the value in the another view.If i also give any static string value,then also i am able to the static string value back.Only the formatted date which is string is set then the session restarts.If i print and check the value of the formatted date it prints the correct formatted date only.Please help me out.Here is my code for date conversion
NSString *dateval=[[stories objectAtIndex: storyIndex] objectForKey:@"date"];
NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];
[inputFormatter setDateFormat:@"EEE, MMM dd, yyyy"];
NSDate *inputDate = [inputFormatter dateFromString:dateval];
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
[outputFormatter setDateFormat:@"MMMM dd"];
NSString *outputDate = [outputFormatter stringFromDate:inputDate];
AppDelegate *delegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
[delegate setCurrentDates:outputDate];
Thanks.
© Stack Overflow or respective owner