Hi,
I have an UIViewController into an navigationController.All I want is when I rotate from landscape into portrait, to change the view into another one which belong to another view controller(another tab from the bottom tab bar controller). I have done this using the following code:
-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if(UIInterfaceOrientationIsPortrait(toInterfaceOrientation)){
UIViewController *controller = [[[UIApplication sharedApplication] delegate].tabBarController.viewControllers objectAtIndex : 1];
[UIView beginAnimations: nil context: nil];
[[self view] setAlpha:0.0];
[[[UIApplication sharedApplication] delegate].tabBarController setSelectedViewController:controller];
[UIView commitAnimations];
}
}
All just fine, but I want to control the views switching like this: -when rotating, I want the current view to dissapear and the second one to appear(like fading in). - this before the actually rotation to take place.
The problem is that the current view do not dissapear immediately, it persist for about 0.2 seconds in the rotation process.
[[self view] setAlpha:0.0]; does not work here - I guess is modified again to be visible by the defalut animation block which is proceed by every View when rotating it.
Could somebody give me a solution?
Appreciate, Alex.