防止UITableView滚动? [英] Preventing UITableView from scrolling?

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

问题描述

这似乎是一个常见问题,如果之前有人问过,请道歉。

This seems like it'd be a common question, so apologies if it's been asked before.

我正在试图弄清楚如何防止UITableView滚动在我的iPhone应用程序中。我希望我的桌子垂直锁定,这样任何数量的屏幕滑动都不会导致它移动。

I'm trying to figure out how to prevent UITableView from scrolling in my iPhone application altogether. I want my table to be vertically locked, so that no amount of screen swiping will cause it to move.

我该如何实现?谢谢。

推荐答案

您可以通过XIB以及编程方式实现。

You can do that from your XIB as well as programmatically.

来自XIB:

只需选择tableView并在Inspector中取消选中水平反弹& amp;垂直弹跳并水平滚动并垂直滚动

Just select the tableView and in Inspector uncheck bounce horizontally & bounce vertically and scroll horizontally and scroll vertically

编程:

如果你想要以编程方式执行此操作然后您可以尝试

If you want to do that programmatically then you can try

self.tableView.scrollEnabled = NO; 

OR

[self.tableView setScrollEnabled:NO];

希望这可以帮到你。

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

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