Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Moon013

macrumors newbie
Original poster
Jul 14, 2008
23
0
I have this created under my viewdidload()

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
UIDeviceOrientation orientationType = [[UIDevice currentDevice] orientation];

And i go about testing orientation by doing these in a function:

if(orientationType == UIDeviceOrientationPortrait || orientationType == UIDeviceOrientationPortraitUpsideDown)
{
testingLabel.text = @"ZOOM PORTRAIT DETECTED";
}
else if (orientationType == UIDeviceOrientationLandscapeLeft || orientationType == UIDeviceOrientationLandscapeRight)
{
testingLabel.text = @"ZOOM LANSCAPE DETECTED!";
}
else
{
testingLabel.text = @"NONE";
}
*testingLabel is linked correctly and tested*

I test by going to the hardware->Rotate Left/ Rotate Right.

And i will do something to call out the function. Upon called, the debugger show "NONE"

Am i missing out something? Or it is just that I will need to test on an actual iPhone?
 
viewDidLoad only loads once when the view is instantiated. I'm not even sure UIDeviceOrientation is available during the viewDidLoad phase. There is a method called by the phone every time the orientation changes.

Code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;

Put your code in there.

---gralem
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.