如何使UIView可滚动? [英] How to make a UIView Scrollable?

查看:310
本文介绍了如何使UIView可滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有一堆UITextfields的UIView.我的问题是我的UITextfields从屏幕的顶部到底部出现.因此,当键盘弹出时,它会覆盖一半的屏幕,因此下面的UITextfields ...我该怎么做,以便在可见键盘时可以通过简单滚动来编辑所有字段?

Hi there I have a UIView with a bunch of UITextfields. My problem is that my UITextfields are present from the top to the bottom of my screen. So when the keyboard pops up, it covers half the screen and consequently the UITextfields below...What can I do so that all the fields can be edited by simmply scrolling when the keyboard is visible?

推荐答案

只需给视图进行新的转换即可将其向上移动.例如

Just give the view a new transform that moves it up. Eg.

[myView setTransform:CGAffineTransformMakeTranslation(0, -keyboardSize.height)];

那也是可动画的,只需为其提供与键盘相同的动画值,它将看起来很完美.

Thats also animatable, just give it the same animation values as the keyboards and it will look perfect.

这篇关于如何使UIView可滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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