Search code examples
iphonesdkscrollbartableviewindicator

TableViewController doesn't flash scroll indicators even if the table is bigger that the view


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.

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];

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];

..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


Solution

  • Or more concisely:

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