2012-06-18 32 views
1

我已经创建了一个装置定向听者赶上当设备旋转时,像这样装置定向到的状态栏定向变化

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

然而jumpBarButtonPosition方法内我已经从使用UIDeviceOrientation到statusBarOrientation改变,因此我摆弄我可以代替UIDeviceOrientationDidChangeNotification与以便只接收有关statudBarOrientation更改的通知。

回答

1

不要键入它作为一个字符串:@“UIDeviceOrientationDidChangeNotification”使用:

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

好正确的..但这个不到风度看起来像它的检查statusbarorientation,唯一的原因,我问这个是因为我会喜欢忽略faceUp和faceDown通知.. – HurkNburkS

+0

设备更改状态栏的方向。但是,如果您有其他方法在不更改设备的情况下更改方向,请在该方法中发布通知。 – Eric

+0

好吧,这就是所有的好..我只是希望忽略那些faceup面朝下的通知,因为他们是多余的我担心,谢谢你的帮助,我将你的标记为正确的,如果我没有在未来几个小时内得到任何答案。干杯。 – HurkNburkS