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