Megfigyelése CLLocationCoordinate2D iPhone SDK

szavazat
0

Az iPhone SDK, tudjuk csak megfigyelni tárgyakat, és nem rugóstagok, mint CLLocationCoordinate2D?

Példa: Van néhány nagyon egyszerű kódot, ahol szeretnék, hogy megfigyelje a tulajdon típusú CLLocationCoordinate2D, már gondoskodott arról, hogy szintetizálni a ABC.m.

@interface ABC
{
 CLLocationCoordinate2D currentLocation;
}
@property (nonatomic, readwrite) CLLocationCoordinate2D currentLocation;

Most egy másik osztályba én:

[ABC addObserver:self forKeyPath:@currentLocation options:NSKeyValueObservingOptionNew context:NULL];

Valamilyen oknál fogva, a observeValueForKeyPath módszer nem számol be, hogy kulcserőforrás „ currentLocation” változott.

Kösz,

SJS

A kérdést 28/08/2009 04:51
a forrás felhasználó
Más nyelveken...                            


1 válasz

szavazat
0

Ez a szó hívást, amit csinál?

[ABC addObserver:self forKeyPath:@"currentLocation" options:NSKeyValueObservingOptionNew context:NULL];

Ha igen, akkor azt hiszem, a kérdés az, hogy figyelik az osztály ABC és nem például az osztály ABC. Feltéve, hogy van egy osztály példánya ABC próbálja megfigyelni, hogy.

ABC* myObject = [ [ [ ABC alloc ] init ] autorelease ];
[ myObject addObserver: self forKeyPath: @"currentLocation" options: NSKeyValueObservingOptionNew context: NULL ];
Válaszolt 29/08/2009 14:01
a forrás felhasználó

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more