UIViewController not oreintating. Methods not called
Posted
by capple
on Stack Overflow
See other posts from Stack Overflow
or by capple
Published on 2010-05-27T10:01:13Z
Indexed on
2010/05/27
10:21 UTC
Read the original article
Hit count: 429
uiviewcontroller
|screen-orientation
Greetings,
This question does seem to be an ongoing saga in the world of iphone SDK... so heres my contribution...
Had two separate projects from the same template... one semi-works, the other not at all... Please let me explain my steps...
used this basic GL ES template //iphonedevelopment.blogspot.com/2008/12/opengl-project-template-for-xcode.html had to sort out some of the 'Release' configuration but otherwises has eveything I need to add orientation to a GL ES project.
One my first project, did my stuff, then added these methods....
-(BOOL)shouldAutoRotateToInterfaceOrientation .....
-(void)willRotateToInterfaceOrientation ....
-(void)didRotateFromInterfaceOrientation ....
-(void)willAnimateRotationToInterfaceOrientation ....
And understand what they do (or are trying to do in my case), the (BOOL)should... gets called once when the view controller is created, and returns 'YES'. But after that none of the other methods are called!
So I started from scratch with a blank template (GL ES one from above)...and added minimum to support auto rotation. But this time none of the methods get called!
So I investigated .... //developer.apple.com/iphone/library/qa/qa2010/qa1688.html as it said, I added the GLViewController.view first, then added the GLview as subviews of the application delegate. Nothing!
Then found this //www.iphonedevsdk.com/forum/iphone-sdk-development/44993-how-determine-ipad-launch-orientation.html which states to enable orientation notifications
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
and then subsequently disable them in the view controller... makes sense...did it, nothing...
I think the notifications might be on by default though, since I didn't need to enable them in the first project, yet it still try to verify a orientation (i.e (BOOL)shouldAutoRotate... )...
If any one could help me out it would be greatly appreciated as this issue is driving me insane. Thanks in advance.
The code can be found here ... http://rapidshare.com/files/392053688/autoRotation.zip
N.B These projects avoid nib/xib resources, would like to keep it that way if possible.
P.S iPad device not out where I am so I cannot test on a device yet. Would be nice for it to work on the simulator.
© Stack Overflow or respective owner