当UITextField成为第一响应者时,禁用UIScrollView滚动 [英] Disable UIScrollView scrolling when UITextField becomes first responder
本文介绍了当UITextField成为第一响应者时,禁用UIScrollView滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当嵌入 UIScrollView
的 UITextField
成为第一响应者时,让我们说用户输入一些字符, UIScrollView
自动滚动到该字段,有没有办法禁用它?
When a UITextField
, embedded in a UIScrollView
becomes first responder, by lets say the user typing in some character, the UIScrollView
scrolls to that Field automatically, is there any way to disable that?
推荐答案
以Moshe的答案为基础......
Building on Moshe's answer...
子类UIScrollView并覆盖以下方法:
Subclass UIScrollView and override the following method:
- (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated
把它留空。完成工作!
这篇关于当UITextField成为第一响应者时,禁用UIScrollView滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文