如何在UITableView中显示滚动条 [英] How to display scrollbar in UITableView

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

问题描述

我想显示某种指示以引导用户滚动。

I want to display some kind of indication to guide user to scroll.

通常当我们触摸UITableView时,如果需要,会出现滚动条。但是我希望这个滚动条指示已经显示在我的tableview上。

Usually when we touch the UITableView scrollbar appears if needed. But I want this scrollbar indication already displayed on my tableview.

怎么可能这样做?

推荐答案

如果你的桌面视图在屏幕外,你可以调用

If you have a table view that goes offscreen, you can call

[self.tableView flashScrollIndicators] ;

它们会闪烁以向用户显示它们在那里。这通常放在viewDidAppear中。

and they will flash to show the user that they are there. This is usually put in viewDidAppear.

(如果从UITableViewController继承,那么你将有一个self.tableView实例变量,如果不是那么替换另一个UITableView。)

(If you inherit from UITableViewController then you will have a self.tableView instance variable, if not then substitute another UITableView.)

如果滚动视图的整个内容适合其视图,则不显示滚动条;测试此显示只有一个单元格的表视图。如果内容大小大于视图的框架,则会显示滚动条;只有这样 [self.tableView flashScrollIndicators]; 实际上是flash滚动指示器。

If you a scroll view's entire contents fit within its view then no scroll bars are displayed; to test this display a table view with only one cell. If the content size is larger than the view's frame then scroll bars will be displayed; only then will [self.tableView flashScrollIndicators]; actually flash scroll indicators.

这篇关于如何在UITableView中显示滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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