This two methods are added in ViewController which i want to move from portrait to landscape. I still keep my "Use Autolayout" checkbox UNCHECKED for scroll view.
- (NSUInteger)supportedInterfaceOrientations
{
return (UIInterfaceOrientationMaskAll);
}
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft
|| toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
CGRect rect = self.view.frame;
rect.size.width = self.view.frame.size.width+245;
rect.size.height = self.view.frame.size.height+245;
self.scrollView.frame = rect;
}
}
This is added in AppDelegate.m file
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return (UIInterfaceOrientationMaskAll);
}
This did the trick for me. Hope it helps.