可以设置不同大小的纵向和横向滚动?

时间:2014-08-07 02:58:00

标签: iphone xcode5 scrollview

可以为纵向和横向设置不同大小的卷轴吗? 示例:纵向:x500 y568          横向:x568 y320

Home.h

@interface主页:UIViewController {

IBOutlet UIScrollView *ScrollerHome;

}

@end

Home.m

  • (void)viewDidLoad { [super viewDidLoad];

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

    }

    @end

1 个答案:

答案 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)];
}