0

我有一个创建日历的类。其中一种方法查找用户点击的日期,并将其存储在同一类的 CFGregorianDate 对象中

当用户点击日历日期时,我需要在另一个类中知道,但是在更新 CFGregorianDate 对象之后,我可以做一些后端处理。

如何在二等舱中获得点击通知?

4

1 回答 1

2

考虑NSNotificationCenterClass一个选项给你..

 // add this in your anotherClass
 [[NSNotificationCenter defaultCenter] removeObserver:self];
 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(objectUpdated:) name:@"objectUpdated" object:nil];



 //then post notification after you updated the CFGregorianDate
 NSNotificationCenter *ncSubject = [NSNotificationCenter defaultCenter];  
 [ncSubject postNotificationName:@"objectUpdated" object:nil];  
 [ncSubject removeObserver:self];
于 2012-06-26T14:57:20.670 回答