And*_*rea 15 iphone sdk scrollbar indicator tableview
我对TableViewController有一个奇怪的问题.在文档中,它表示当表格"超大"时,tableViewController还处理方法-flashScrollIndicators,尊重可见区域.
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.
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];
Run Code Online (Sandbox Code Playgroud)
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];
Run Code Online (Sandbox Code Playgroud)
..without result.
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.
Is a bug?, is there a correct way to show it programmatically? Can someone help me? Regards, Andrea
Hil*_*ell 41
或者更简洁:
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self.tableView performSelector:@selector(flashScrollIndicators) withObject:nil afterDelay:0];
}
Run Code Online (Sandbox Code Playgroud)
jow*_*wie 12
我有完全相同的问题.我最后通过在viewDidAppear:方法中放入一个延迟选择器来解决它.奇怪的是,我可以将它设置为0秒,它仍然可以正常工作.
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self performSelector:@selector(flashTableScrollIndicators) withObject:nil afterDelay:0.0];
}
- (void)flashTableScrollIndicators
{
[self.tableView flashScrollIndicators];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7991 次 |
| 最近记录: |