简体   繁体   English

如何使模态视图可滚动?

[英]How to make modal view scrollable?

I have a modal view with a textview and a button. 我有一个带有textview和一个按钮的模式视图。 When the keyboard is displayed it covers up some of my UI elements. 显示键盘时,它掩盖了我的一些UI元素。 I'd like my modal to be scrollable so that it can be viewed while the keyboard is displayed. 我希望模态是可滚动的,以便在显示键盘时可以查看它。 How can I do this? 我怎样才能做到这一点?

I've had the same question, and i've played with it a bit, setting a UIScrollView is not enough, as in the inspector you should 1st. 我有同样的问题,并且我已经玩了一点,设置UIScrollView是不够的,因为在检查器中您应该1。 increase it Hight, then in the attributes, check the following checkboxes: Scrolling enabled, Bounce Scroll, always bounce vertically. 增加它的高度,然后在属性中,选中以下复选框:启用滚动,退回滚动,始终垂直退回。

Edited: Forgot the most inportant thing: in the size inspector, set the Buttom field (under content) to the size you wish, (960 is twice the regular size) 编辑:忘记了最重要的事情:在尺寸检查器中,将Buttom字段(在内容下)设置为所需的尺寸(960是常规尺寸的两倍)

Use a UIScrollView instead of an ordinary UIView. 使用UIScrollView而不是普通的UIView。 You can disable scrolling when you don't want the user to be able to with: 当您不希望用户使用以下功能时,可以禁用滚动:

[theView setScrollEnabled:NO];

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

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