[英]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.