键盘出现时为什么UICollectionView偏移会发生变化 [英] Why UICollectionView offset changes when keyboard appears
问题描述
我正在开发一款iPad应用程序,它具有水平 UICollectionView
。每个单元格都有一个 UITextField
。当 UITextField
成为第一响应者时,键盘自动出现,并且令人惊讶的是所有单元格都向上移动。
I'm developing an iPad app, that has a horizontal UICollectionView
. Each of the cells has a UITextField
. When the UITextField
becomes first responder, the keyboard automatically comes up, and surprisingly all the cells move upwards.
我还没有为细胞向上移动实施任何逻辑。你知道为什么吗?
I haven't implemented any logic for the cells to move upwards. Do you know why?
我没有找到任何关于此的文件,我无法解决这个问题。
I haven't found any documentation regarding this, and I'm unable to fix this.
推荐答案
此行为由Apple实施。如果出现键盘,标准 UICollectionView
会照顾您滚动到正确的位置。你为什么想解决这个问题?
This behaviour is implemented by Apple. The standard UICollectionView
takes care for you to scroll to the correct position if a keyboard appears. Why would you want to fix this?
这篇关于键盘出现时为什么UICollectionView偏移会发生变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!