Subclass the top most controller .
For example you have a navigation controller as the top most controller then you just need to
subclass UINavigationController and write the following line of code in .m file of the subclass
- (BOOL)shouldAutorotate
{
return [[self.viewControllers lastObject] shouldAutorotate];
}
- (NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
Now overwrite the method - (BOOL)shouldAutorotate for each of the controllers in your project.
Return TRUE for those controller for which you need to do rotation and Return FALSE for those controller for which you dont need to do rotation .
Cheers!!!!!