简体   繁体   English

使用IB可以滚动视图

[英]Make view scrollable with IB

How to make the content of view scrollable using IB ? 如何使用IB使视图内容可滚动?

I know how to do that programmatically, but can't figure out how to that using IB. 我知道如何以编程方式执行此操作,但无法弄清楚如何使用IB。 I have googled, but didn't found useful solution. 我用谷歌搜索,但没有找到有用的解决方案。

You want to drag a scroll view widget from right-side panel under objects onto the .xib file's view. 您希望将滚动视图窗口小部件从对象下的右侧面板拖动到.xib文件的视图中。 You can then add other views inside the scroll view by dragging. 然后,您可以通过拖动在滚动视图中添加其他视图。 In this exam I've dragged a UILabel view onto the scroll view to place it inside. 在这次考试中,我将UILabel视图拖到滚动视图上以将其放入其中。 You can see the view hierarchy on the left in Xcode. 您可以在Xcode中看到左侧的视图层次结构。

I've attached a screenshot that shows a section of Xcode 4 which should demonstrate everything you need! 我附上了一个截图,显示了Xcode 4的一部分,它应该展示你需要的一切! Note that the view hierarchy here is as follows: 请注意,此处的视图层次结构如下:

UIView (Standard UIView that was created by Xcode when I made the .xib user interface file) > UIScrollView > UILabel UIView(当我制作.xib用户界面文件时由Xcode创建的标准UIView)> UIScrollView> UILabel

在此输入图像描述

Hope this helps! 希望这可以帮助!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM