I have updated my Xcode to 4.5 , I have implemented the orientation methods as below
-(BOOL)shouldAutorotate{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
I am setting the frame sizes of buttons ,labels,images in willRotateToInterfaceOrientation method
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait )||
([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortraitUpsideDown ))
{
// set frame sizes for portait
}
else if(( [[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft )||
([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight ))
{
// set frame sizes for landscape
}
}
but sometimes this method is not getting called when rotating the simulator and sometimes the simulator is not detecting orientation when navigating from another viewController . I have checked info.plist file - it is fine.