I have been pulling my hair out for days, going down multiple blind paths; each no no end in sight. I am trying to do something that should be pretty simple. When the phone is in portrait mode I want UIView portrait to display. When in landscape I want UIView (yip you guessed it) landscape to load. Both of these UIViews are in the same nib file that is assoicated to my WERTYkeyboardForVIN class. Prior to adding any codes to switch views I am trying to just simply log to NSLog the current state (after that I will wrap my view codes in there).
I am sure I am screwing up something very simple (and stupid). Any thoughts or help would be greatly appreciated.
I am able to get shouldAutorotateToInterfaceOrientation to work:
As you would expect this outputs the following to the log:
WERTYkeyboardForVIN shouldAutorotateToInterfaceOrientation
- shouldAutorotateToInterfaceOrientation - UIInterfaceOrientationPortrait, returning YES
But when it comes to willAnimateRotationToInterfaceOrientation this method is never called and I am not sure why.
I *think* my problem is with a different view controller being 'in control' of the screen, but I do not know how to find out. Is there a debugging code I can type in gdb to find out the currently active view controller?
FYI here is how I am initializing WERTYkeyboardForVIN from ACMainMenu.m (I have also tried the codes in this class thinking since it is a view controller it might be in control, but nope...)
Also I have tried placing my willAnimateRotationToInterfaceOrientation in the appDelegate to see if that was the problem, also tried it in my ACMainMenu (which is the primary view controller that is setup when the app launches).
thanks
Steven
I am sure I am screwing up something very simple (and stupid). Any thoughts or help would be greatly appreciated.
I am able to get shouldAutorotateToInterfaceOrientation to work:
Code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
NSLog(@"WERTYkeyboardForVIN shouldAutorotateToInterfaceOrientation");
if (interfaceOrientation == UIInterfaceOrientationPortrait)
{
NSLog(@" - shouldAutorotateToInterfaceOrientation - UIInterfaceOrientationPortrait, returning YES");
return YES;
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
NSLog(@" - shouldAutorotateToInterfaceOrientation - UIInterfaceOrientationLandscapeRight, returning YES");
return YES;
}
else
{
NSLog(@" - else - returning NO");
return NO;
}
}
As you would expect this outputs the following to the log:
WERTYkeyboardForVIN shouldAutorotateToInterfaceOrientation
- shouldAutorotateToInterfaceOrientation - UIInterfaceOrientationPortrait, returning YES
But when it comes to willAnimateRotationToInterfaceOrientation this method is never called and I am not sure why.
Code:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{
NSLog(@"WERTYkeyboardForVIN - willAnimateRotationToInterfaceOrientation");
if (interfaceOrientation == UIInterfaceOrientationPortrait)
{
NSLog(@" - willAnimateRotationToInterfaceOrientation - UIInterfaceOrientationPortrait");
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
NSLog(@" - willAnimateRotationToInterfaceOrientation - UIInterfaceOrientationLandscapeRight");
}
else
{
NSLog(@" - willAnimateRotationToInterfaceOrientation - else");
}
}
I *think* my problem is with a different view controller being 'in control' of the screen, but I do not know how to find out. Is there a debugging code I can type in gdb to find out the currently active view controller?
FYI here is how I am initializing WERTYkeyboardForVIN from ACMainMenu.m (I have also tried the codes in this class thinking since it is a view controller it might be in control, but nope...)
Code:
// Show WERTYkeyboardForVIN
if (wERTYkeyboardForVIN == nil)
{
WERTYkeyboardForVIN *controller = [[WERTYkeyboardForVIN alloc] initWithNibName: @"WERTYkeyboardForVIN" bundle:[NSBundle mainBundle]];
self.wERTYkeyboardForVIN = controller;
[controller release];
[appDelegate.window addSubview:[self.wERTYkeyboardForVIN view]];
}
else
{
[appDelegate.window bringSubviewToFront:[self.wERTYkeyboardForVIN view]];
}
Also I have tried placing my willAnimateRotationToInterfaceOrientation in the appDelegate to see if that was the problem, also tried it in my ACMainMenu (which is the primary view controller that is setup when the app launches).
thanks
Steven