質問

I have created a device orientation listener to catch when the device is rotated, like so

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(jumpBarButtonPosition)
                                                 name:@"UIDeviceOrientationDidChangeNotification" object:nil];

however inside the jumpBarButtonPosition method I have changed from using UIDeviceOrientation to statusBarOrientation, so I am woundering what I could replace UIDeviceOrientationDidChangeNotification with in order to only receive notifications about the statudBarOrientation changes.

役に立ちましたか?

解決

Don't type it as a string:@"UIDeviceOrientationDidChangeNotification" use:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(jumpBarButtonPosition)
                                             name:UIDeviceOrientationDidChangeNotification object:nil];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top