Dans l'iPhone SDK, pouvons-nous seulement observer des objets, et non des entretoises comme CLLocationCoordinate2D
?L'observation de CLLocationCoordinate2D dans l'iphone SDK
Exemple: J'ai un code très simple où j'aimerais observer une propriété de type CLLocationCoordinate2D
, je me suis assuré de la synthétiser dans ABC.m.
@interface ABC
{
CLLocationCoordinate2D currentLocation;
}
@property (nonatomic, readwrite) CLLocationCoordinate2D currentLocation;
maintenant dans une autre classe que je fais:
[ABC addObserver:self forKeyPath:@"currentLocation" options:NSKeyValueObservingOptionNew context:NULL];
Pour une raison quelconque, la méthode observeValueForKeyPath ne retourne jamais que keypath "currentLocation
" a changé.
Merci,
SJS