13

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

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

How is it possible to do so?

Nic
  • 609
  • 4
  • 12
  • 21
  • late too but: I wrote a possibility at http://stackoverflow.com/questions/3412629/how-to-always-visible-scroller-of-tableview-in-obj-c/5002298#5002298 – Gerold Feb 15 '11 at 10:17

2 Answers2

37

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

[self.tableView flashScrollIndicators];

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

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

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.

fearmint
  • 5,276
  • 2
  • 33
  • 45
  • This only flashes it, as said by Mike below it shows when the user scrolls but otherwise is hidden. – fearmint Dec 30 '09 at 19:25
12

There's no way to force the scrollbar to appear, short of messing with the internals of UITableView(which you shouldn't do), or redesigning your own table view class.

Per the documentation of UIScrollView's showsVerticalScrollIndicator property: "The indicator is visible while tracking is underway and fades out after tracking."

Mike
  • 23,892
  • 18
  • 70
  • 90