1

It's possible set different size a scroll for portrait and landscape orientation? Example: Portrait orientation: x500 y568 Landscape orientation: x568 y320

Home.h

@interface Home : UIViewController {

IBOutlet UIScrollView *ScrollerHome;

}

@end

Home.m

  • (void)viewDidLoad { [super viewDidLoad];

    //----------------------------------ScrollView Home---------------------------------------// [ScrollerHome setScrollEnabled:YES]; [ScrollerHome setContentSize:CGSizeMake(815, 610)];

    }

    @end

Swr79
  • 75
  • 1
  • 10

1 Answers1

1
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

if (orientation == UIDeviceOrientationPortrait || orientation ==
 UIDeviceOrientationPortraitUpsideDown) 
{
    //portrait        
    [ScrollerHome setContentSize:CGSizeMake(500, 568)];
 }
else if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight)
{
    //landscape
    [ScrollerHome setContentSize:CGSizeMake(568, 320)];
}
Tapas Pal
  • 6,566
  • 6
  • 32
  • 76
Senthil
  • 492
  • 12
  • 28