2012-03-15 5 views
3

私は、アプリケーションデリゲートのプロパティのUIViewControllerにオブザーバを追加したいと思います。別のクラスのプロパティのKVO

以下のコードは可能ですか?

myAppDelegate *appDelegate = (myAppDelegate *)[[UIApplication sharedApplication] delegate]           ; 


    [self addObserver:self 
      forKeyPath:appDelegate.currentLocation 
       options:0 
       context:nil]; 

「forKeyPath」の値がNSStringであると予想される問題です。

答えて

6
myAppDelegate *appDelegate = (myAppDelegate *)[[UIApplication sharedApplication] delegate]          ; 

[appDelegate addObserver:self 
       forKeyPath:@"currentLocation" 
       options:0 
       context:nil]; 
関連する問題