可以为纵向和横向设置不同大小的卷轴吗? 示例:纵向:x500 y568 横向:x568 y320
@interface主页:UIViewController {
IBOutlet UIScrollView *ScrollerHome;
}
@end
(void)viewDidLoad { [super viewDidLoad];
// ---------------------------------- ScrollView Home --------- ------------------------------ // [ScrollerHome setScrollEnabled:YES]; [ScrollerHome setContentSize:CGSizeMake(815,610)];
}
@end
答案 0 :(得分: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)];
}