如何将 UIToolbar 固定到 UIScrollView 中的屏幕底部
我有一个包含 UIToolbar 的 UIScrollView,但是当我滚动时,工具栏也会滚动,与屏幕底部分开。有没有办法让工具栏在滚动时粘在屏幕底部?
我尝试创建一个包含 ScrollView 和工具栏的视图,但是当程序运行时,我只能看到 ScrollView。这个问题可能是由于 ScrollView 绘制在工具栏顶部造成的,但我不确定。
如果您对这两种方法(甚至是我还没有想到的第三种方法)中的任何一种提供帮助,我们将不胜感激。
谢谢,
克里斯
I have a UIScrollView that contains a UIToolbar, but when I scroll, the toolbar scrolls as well, separating from the bottom of the screen. Is there a way to make the toolbar stick to the bottom of the screen as the scroll happens?
I tried to create a view that contained both the ScrollView and the Toolbar, but when the program runs, the ScrollView is all that I can see. This problem could be due to the ScrollView being drawn on top of the toolbar, but I'm not sure.
Any help in either of these two methods (or even a third that I haven't thought of yet) would be greatly appreciated.
Thanks,
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用界面生成器,则只需重新调整 UIScrollView 的大小,使其位于 UIToolbar 放置位置的上方。 (首先放置 UIToolbar,UIScrollView 很可能会捕捉以使用可用空间。)
如果您以编程方式添加 UIToolbar,则可以通过选择模拟指标中“底部栏”下的“工具栏”选项来允许其存在属性检查器的部分。
If you're using the interface builder, you can simply re-size the UIScrollView so that it sits above where the UIToolbar will be placed. (Place the UIToolbar first and the UIScrollView will most likely snap to use the available space.)
If you're adding the UIToolbar programmatically, you can allow for its presence by selecting the "Toolbar" option under "Bottom Bar" within the Simulated Metrics section of the attributes inspector.