即使表格大于视图,TableViewController也不会闪烁滚动指示器 [英] TableViewController doesn't flash scroll indicators even if the table is bigger that the view

查看:140
本文介绍了即使表格大于视图,TableViewController也不会闪烁滚动指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对TableViewController有一个奇怪的问题。
在文档中,它表示tableViewController还处理方法
-flashScrollIndicators,当表格超大时,尊重可见区域。

I've got a weird problem with a TableViewController. In the doc it says that a tableViewController deals also with the method -flashScrollIndicators when the table is "oversized" respect the visible area.

我的应用程序包含3个导航控制器中加载的导航控制器。每个导航控制器都具有作为根视图控制器的表视图控制器的子类。
每个模型都是从plist文件中填充的,该文件将其内容加载到-viewDIdLoad中的数组中,稍后所有内容都将传递给表。一切都是以编程方式加载的,没有IB。

My app consists in 3 nav controller loaded in a tab controller. Each nav controller has as root view controller a subclass of a table view controller. Each "model" is populated from a plist file, that loads its contents into an array in the -viewDIdLoad, later everything is passed to the table. Everything is loaded programmatically no IB.

我在我的应用程序中发现,当它加载第一个视图(带有表视图控制器的导航控制器为root)时即使单元格的数量足够大,滚动条也不会闪烁。
如果我选择另一个选项卡,它会加载另一个导航控制器(以t.v.c.为根)滚动条不再显示。当我按下与第一个导航控制器相对应的选项卡时,滚动条会闪烁。

I've found out in my app that when it loads the first view (a nav controller with a table view controller as root) the scroll bar isn't flashing even if the number of cell it's great enough. If I choose another tab, that loads another nav controller (with a t.v.c. as root) scroll bar isn't shown again. When I press the tab corresponding to the first nav controller loaded the scrollbar flashes.

所以我试图以编程方式进行闪存,但没办法,代码看起来很简单:

So I've tried to make it flash programmatically but no way, the code seems simple:

[self.tableView flashScrollIndicators];

我试图把它放在几乎所有地方。首先在-viewDidLoad中(如文档中所示),然后在viewDidAppear和-viewWillAppear中。
还尝试使用该代码来转换t.v.c的视图。作为表格视图。

I've tried to put it almost everywhere. First in the -viewDidLoad (As suggested in the doc), then in viewDidAppear and in -viewWillAppear. Also tried use that code tring to cast the view of the t.v.c. as a table view.

[((UITableView*)self.view) flashScrollIndicators];

..没有结果。

I我开始看Apple样本,我发现在Apple的表格视图中,自定义样本(具有不同时间的样本)滚动条也不会闪烁。
在sim和设备上都进行了测试。

I've started looking at Apple sample and I've found that in Apple's table view custom sample (the one with different times) scroll bar doesn't flash also there. Tested both on sim and device.

是一个错误?,是否有正确的方式以编程方式显示它?
有人能帮帮我吗?
问候,
Andrea

Is a bug?, is there a correct way to show it programmatically? Can someone help me? Regards, Andrea

推荐答案

或更简洁:

- (void)viewDidAppear:(BOOL)animated {
  [super viewDidAppear:animated];
  [self.tableView performSelector:@selector(flashScrollIndicators) withObject:nil afterDelay:0];
}

这篇关于即使表格大于视图,TableViewController也不会闪烁滚动指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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