私は iOS Big Nerd Ranch の本を読んでいましたが、例の 1 つは、オブザーバーを NSNotificaionCenter に追加する方法を示しています。
    [[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(orientationChanged:)
                                             name:UIDeviceOrientationDidChangeNotification
                                           object:[UIDevice currentDevice]];
現在、orientationChanged では、方向が NSNotification に投稿されたオブジェクトから取得されます。
- (void)orientationChanged:(NSNotification *)note {
    NSLog(@"orientationChanged  %d", [[note object] orientation]);
 }
私の混乱はこの行にあります: [[note object] orientation]
NSNotification のオブジェクトはidを返すため、コンパイル時にオブジェクトの型が UIDevice であることがわかりません。ただし、コンパイラからエラーが発生することなく、返されたオブジェクトから向きにアクセスできます。コンパイラは、オブジェクト タイプが UIDevice であり、方向へのアクセスが許容されることをどのように認識しますか?