如何使用Storyboard布置比Xcode 7.2上的屏幕高的屏幕内容? [英] How to use Storyboard to lay out screen content that is taller than the screen on Xcode 7.2?

查看:64
本文介绍了如何使用Storyboard布置比Xcode 7.2上的屏幕高的屏幕内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用swift 2.0进行编程,我对在视图控制器上添加更多对象感到困惑.例如,我需要在视图控制器上具有所需约束的14个按钮.但是我只能在故事板上的视图控制器中一个接一个地添加7个按钮.因为没有更多的地方在视图控制器上添加对象.那么,如何在故事板上的视图控制器中添加对象数量呢?请参考以下屏幕截图.感谢您的帮助.

I use swift 2.0 for programming and I'm confused with adding more objects on view controller. For example, I need 14 buttons on my view controller with required constraints. But I'm able to add only 7 buttons one by one in my view controller on story board. Because no more place to add objects on view controller. So, How to add number of objects in view controller on story board?. Please refer following screen shots. Thanks for your help friends.

故事板上的查看控制器:

我只能添加7个具有适当约束的按钮.但我需要添加14个具有适当约束的按钮.滚动视图控制器时,按钮8到14将分别显示按钮1到7.

I'm able to add only 7 buttons with proper constraints. but i need to add 14 buttons with proper constraints. when view controller is scrolled then the button 8 to 14 will shown one by one respectively button 1 to 7.

在没有滚动视图的iPhone 5上输出:

具有滚动视图的iPhone 4s输出:

我在iPhone 5上需要这样,但需要14个按钮. 8至14个按钮分别排列为1至7个按钮.

I need like this on iPhone 5 , but 14 buttons. The 8 to 14 buttons arranged respectively 1 to 7 buttons.

推荐答案

您可以在情节提要中进行布局.

You can lay this out in a Storyboard.

  1. 单击viewController,然后在 Size Inspector 中将 Simulated Size 设置为 Freeform ,并将宽度设置为320和高度到1136.这样会给您带来高大的瘦身布局.

  1. Click on your viewController, and then in the Size Inspector, set the Simulated Size to Freeform and set the width to 320 and the height to 1136. This will give you a tall skinny layout.

向其中添加一个scrollView.将scrollView调整为全屏大小.将其所有四个侧面固定到其superView.

Add a scrollView to that. Size the scrollView to the full screen. Pin all four of its sides to its superView.

在高大的viewController中布置您的14个按钮.

Lay out your 14 buttons in the tall viewController.

运行时,您的contentView将滚动.

When you run, your contentView will scroll.

这篇关于如何使用Storyboard布置比Xcode 7.2上的屏幕高的屏幕内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆