简体   繁体   English

更改为横向时制作可滚动视图

[英]Making scrollable view when changed to landscape

How can I make a view scrollable when changed to landscape mode? 更改为横向模式后,如何使视图可滚动? eg I have an app in portrait mode, lots of information involved. 例如,我有一个纵向模式的应用程序,涉及很多信息。 I hape preset all struts and springs, but I still need some space in the bottom, so I was thinking enabling scrolling function, but how could I accomplish that? 我已经预置了所有支柱和弹簧,但是底部仍然需要一些空间,因此我想启用滚动功能,但是我该怎么做呢?

The scroll is enabled when the content size is bigger than the frame of the scroll. 当内容大小大于滚动框架时,将启用滚动。 Try the following: 请尝试以下操作:

myScroll.contentSize=CGSizeMake(100.0f,200.0f);
myScroll.frame=CGRect(0.0f,0.0f,100.0f,100.0f);

This will make you scroll vertically, because the height of the content size is bigger than the height of the frame. 这将使您垂直滚动,因为内容大小的高度大于框架的高度。 While this would make you scroll horizontally: 虽然这会使您水平滚动:

myScroll.contentSize=CGSizeMake(100.0f,200.0f);
myScroll.frame=CGRect(0.0f,0.0f,200.0f,200.0f);

Either way, you when your screen rotates, you should handle your logic according that what I explain. 无论哪种方式,当屏幕旋转时,您都应按照我的解释处理逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当视图从纵向更改为横向时,方向不会更改 - Orientation is not changed when view is changed from portrait to landscape 在Swift ios中将方向更改为横向模式时隐藏底表视图 - Hide bottom table view when orientation changed to landscape mode in Swift ios 从纵向更改为横向时,在同一点上滚动视图位置,反之亦然 - Scroll view location at same point when changed from portrait to landscape and vice versa 使View Controller以最简单的方式滚动 - Making a View Controller Scrollable in Easiest Way 启用分页时,使一个单元格在水平可滚动的集合视图中居中,并使其他单元格也部分可见 - Centring a cell of a horizontally scrollable collection view when paging is enabled and making other cells partly visible, too 当iphone转到横向时,在横向中显示模态视图控制器 - Present a modal view controller in landscape when the iphone turn to landscape iOS:iPad切换为横向模式时,tableViewCell的框架发生了变化 - iOS: The frame of tableViewCell changed when iPad switching to landscape 在方向更改为自动布局中的横向时隐藏视图 - Hiding a view when orientation changes to landscape in autolayouts 切换到横向模式时视图布局冲突 - View layout conflicts when switching to landscape mode 横向时全屏快速滚动查看 - swift scroll view fullscreen when landscape
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM