英文:
How to scroll inside of UIScrollView in Xcode Storyboard Editor
问题
我有一个水平滚动的UIScrollView
,它在屏幕外运行。请参见图像:
我想要能够更直接地在Storyboard中编辑内容,而不是猜测要放置视图等。正如你在上面的图像中所看到的,你无法看到UILabel
的整个文本,也无法看到末尾的ImageView
,更不用说我可能想要放置的其他任何内容了。
我正在使用Xcode 14.2。
英文:
I have a horizontally scrolling UIScrollView
that runs "off" the screen. See image:
I want to be able to edit the content more directly in the Storyboard rather than guessing where to put Views etc. As you see in the image above, you can't see the entire text of the UILabel
, nor the ImageView
at the end, much less anything else I might want to put there.
I'm using Xcode 14.2.
答案1
得分: 1
我在十年前回答过这个问题,也许在几个月后以更好的方式回答了,但由于苹果设计的无尽变化,此过程略有不同,所以这里有一个新答案。
在故事板编辑器中无法滚动滚动视图。作为一种解决方法,您可以使场景变宽,滚动视图变宽,以便在故事板编辑器中查看其所有内容。
-
在故事板大纲中选择视图控制器。
-
打开“尺寸检查器”。将“模拟大小”设置从“固定”更改为“自由形式”。
-
根据需要增加模拟大小的宽度,以便可以使滚动视图足够宽以查看其所有内容。根据您的约束(或自动调整掩模)的设置方式,滚动视图可能会自动变宽。
英文:
I answered this ten years ago, and in a perhaps better way a few months after, but due to the endless vicissitude of Apple's designs, the procedure has become slightly different, so here's a new answer.
You can't scroll a scroll view in the storyboard editor. As a workaround, you can make the scene wider, and the scroll view wider, so that you can see all of its content in the storyboard editor.
-
Select the view controller in the storyboard outline.
-
Open the Size inspector. Change the setting for “Simulated Size” from “Fixed” to “Freeform”.
-
Increase the width of the simulated size as needed so that you can make your scroll view wide enough to see all its content. Depending on how your constraints (or autoresizing mask) are set up, the scroll view may get wider automatically.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论