Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display scrollbar in UITableView

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?

like image 618
Nic Avatar asked Dec 30 '09 05:12

Nic


People also ask

Is UITableView scrollable?

Scrolling to a certain point in a table view is a common requirement. For example, you might scroll to show new entries after loading new data or to show that a row has updated data. Since UITableView inherits from UIScrollView it's easy to scroll programmatically.

What is scroll view in Swift?

The scroll view displays its content within the scrollable content region. As the user performs platform-appropriate scroll gestures, the scroll view adjusts what portion of the underlying content is visible. ScrollView can scroll horizontally, vertically, or both, but does not provide zooming functionality.

How do I hide the scrollbar in react native?

There is no way to hide the scrollbar in a scrollview in React Native.


2 Answers

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.

like image 178
JoePasq Avatar answered Oct 13 '22 20:10

JoePasq


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

like image 33
Mike Avatar answered Oct 13 '22 20:10

Mike