Hi all,
I am using the delegate method for auto rotation in iphone application.
-(BOOL)shouldAutorotateToInterfaceOrientation:UIInterfaceOrientation)interfaceOrientation{
if(interfaceOrientation == UIInterfaceOrientationPortrait ){
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:0.2f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
self..view.transform = CGAffineTransformMakeRotation(0);
self.view.bounds = CGRectMake(0,0,320,460);
[UIView commitAnimations];
self.navigationBar.frame=CGRectMake(0, 0, 320, 44);
}else if(interfaceOrientation == UIInterfaceOrientationLandscapeRight){
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:0.2f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
CGAffineTransform transform = CGAffineTransformMakeRotation(3.14159/2);
self.view.transform = transform;
CGRect contentRect = CGRectMake(10, -10, 480, 300);
self.view.bounds = contentRect;
[UIView commitAnimations];
self.navigationBar.frame=CGRectMake(0, 0, 480, 32);
}else if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
//navigationController.navigationBar.frame=CGRectMake(0, 0, 480, 34);
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:0.2f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
CGAffineTransform transform = CGAffineTransformMakeRotation(-3.14159/2);
self.view.transform = transform;
CGRect contentRect = CGRectMake(-10, -10, 480, 300);
self.view.bounds = contentRect;
[UIView commitAnimations];
self.navigationBar.frame=CGRectMake(0, 0, 480, 32);
}else if(interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ){
return NO;
}
return YES;
}
It is working fine on iphone OS3 but on iphone OS4, when rotating to landscape mode, the interface displays incorrectly (http://www.freeimagehosting.net/image.php?2edf4a9702.png) When rotating back to portrait mode the interfaces compresses....(http://www.freeimagehosting.net/image.php?2da25c4c07.png)
Please suggest me any suggestion how I resolve it ??
Thanks
Deepika