禁用UITableView中的滚动(iPhone SDK 3.0) [英] disable scrolling in a UITableView (iPhone SDK 3.0)

查看:97
本文介绍了禁用UITableView中的滚动(iPhone SDK 3.0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在中嵌入 UITextField 时禁用 UITableView 中的滚动C>的UITableViewCell
这只是为了防止单元格在编辑时滚动到视线之外(并且还避免一些相关的单元格回收问题)。
谷歌搜索时,我看到有人建议显而易见:

I'm trying to disable scrolling in a UITableView when editing a UITextField embedded in a UITableViewCell. This is just to prevent the cell from being scrolled out of sight when edited (and also to avoid some related cell "Recycling" problems). While googling around I've seen that somebody suggested the obvious:

tableView.scrollEnabled = NO:

甚至

tableView.userInteractionEnabled = NO;

这不起作用(至少对我来说...... iPhone SDK 3.0,在模拟器上试过)
我将这些属性设置为NO,我甚至通过记录将属性设置为NO进行检查,但是UITableView会继续正常响应触摸事件。
它也很乐意滚动。
如果网上有人没有声称这确实有效,我不会那么担心。

This does not work though (at least for me... iPhone SDK 3.0, tried on simulator) I set these properties to NO, I even check by logging that the properties are set to NO, but the UITableView keeps on responding normally to touch events. And it also happily scrolls. I wouldn't be that worried if somebody on the net were not claiming that this actually works.

我错过了什么吗?
或者是UITableView的唯一替代子类,使其超类(UIScrollView)中的功能再次可用吗?

Am I missing something? Or is the only alternative subclassing UITableView to make a functionality available in its superclass (UIScrollView) work again?

推荐答案

您尝试过使用
self.tableView.scrollEnabled = NO;

我经常试过来自网络的代码不起作用,仅仅是因为缺少前缀self。我刚刚尝试了这个问题。

I've often tried that code from the web didn't work, simply because of a lack of the prefix self. I just tried this out without a problem.

我不知道动态打开和关闭它是否有效。初始化对象时,它至少适用于永久设置...

I don't know if this work when turning it on and off dynamically. It does at least work for permanent settings when initializing the object...

这篇关于禁用UITableView中的滚动(iPhone SDK 3.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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