给我一些建议,请。
是
NSDate *todayDate = [NSDate date];
NSDateFormatter *dateFormat = [[[NSDateFormatter alloc]init]autorelease];
[dateFormat setDateFormat:@"yy-MM-dd"];
todayString = [dateFormat stringFromDate:todayDate];
NSLog(@"today : %@", todayString);
NSDictionary *dicDate = [NSDictionary dictionaryWithObject:todayDate forKey:@"keyDate"];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName:@"connectDate" object:self userInfo:dicDate];
B.m
- (void)noteDate:(NSNotification *)date {
NSLog(@"notification");
NSDate *startDate = [[date userInfo] objectForKey:@"keyDate"];
stampDate = [[[NSDate alloc]init]retain];
NSLog(@"savedDate : %@", startDate);
self.stampDate = startDate;
NSLog(@"notification date : %@", stampDate);
}
- (void)viewDidLoad {
[super viewDidLoad];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(noteDate:) name:@"connectDate" object:nil];
....
}