views:

595

answers:

3

Anyone have a simple way to silence the undocumented UIDevice setOrientation warning?

I found this piece of code that silences the undocumented UIPickerView setSoundsEnabled warning.

+1  A: 

just declare the method in a category in the .h or .m file of wherever you use it:

@interface UIDevice (MyPrivateNameThatAppleWouldNeverUseGoesHere)
- (void) setOrientation:(UIInterfaceOrientation)orientation;
@end
coneybeare
… and hope that Apple doesn't use the "(private)" category on UIDevice. I'd probably call it "(MyUndocumentedMethods)" or something.
BJ Homer
Cool -- works great! What's the category feature originally designed for?
Epsilon Prime
It is meant for extending the functionality of a class. BJ Homer is right… you should not use (private). I will change in the code
coneybeare
To do private method declarations, you can say `@interface UIDevice ()`.
Dustin Voss
A: 

Why not just subscribe to the orientation notifications? They are supported and work at the same time.

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
Kendall Helmstetter Gelner
Heh, I need to change the orientation, not listen to it. The problem stems from having one orientable view in the middle of a chain of navigation. When I leave the rotated view for the view that can only take the portrait orientation I have to force the change because unless there is an orientation change the upcoming view that only can be in portrait mode will be rotated.
Epsilon Prime
A: 

Maybe you should try to add your controller to the window view directly. It's a bit boring but it works well ! http://www.geckogeek.fr/iphone-forcer-le-mode-landscape-ou-portrait-en-cours-dexecution.html :-)

Vinzius

related questions