Pregunta

I have a very tricky code, because sometimes I set a new orientation.

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];

Is it possible to add observer or notification when statusBarOrientation changed? I want to know what is the current orientation.

¿Fue útil?

Solución

The code you are using is very very tricky.

The property you are using is declared as the following:

@property (nonatomic, readonly) UIDeviceOrientation orientation

So, your app will get rejected when using this private method.

If you want to change the interface orientation then you should look into the UIViewController callbacks.

About your question you could do it manually. Send a custom notification after setting the new orientation. Then catch that notification wherever you want. But be aware of what I previously said.

For further info you could see this stackoverflow topic on method-uidevice-setorientation-is-it-still-denied.

Hope it helps.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top