I have a UIScrollView which I create and size dynamically using...
scrollView.contentSize = CGSizeMake(scrollView.frame.size.width , length);
I then add subviews
to the UIScrollView
.
I do have scrollView.showsVerticalScrollIndicator = YES;
When scrolling the scroll indicator never appears.
Even if I call [scrollView flashScrollIndicators]
nothing happens.
Ideas?
Two conditions,
Then, you should check your indicator insets are set to 0 (or any other number that is relevant to your autolayout):
When I've dealt with this before, in my implementation of a grid, I would occasionally get some cells over the top of the scroll indicator. To fix this I am now inserting subviews at index 0 rather than adding them, which adds them to the top. So try something like this:
[scrollview insertSubview:subview atIndex:0];
Noticed this when the UIScrollView was a 48 px tall horizontal band, scrollable horizontally. Maybe Cocoa decides the area is too small for a scroll indicator...
It can happen also if the parent of the scrollview is smaller horizontally than the scroll view itself :
The scroll bar is stuck to the right side of the
ScrollView
/TableView
and this right side is not visible due to the parent bounds ( with a clipToBounds hidding it for instance).I've seen this issue so I share it in case it can help.
Just check the width of your
ScrollView
's frame not to be bigger than the width of its parent view frame.I fix this by adding this code after add new subview:
It will also happen (at least in the case of a UITableView) if the contentSize is too small for the table view to scroll. If you have enabled bouncing, then the tableview does not actually scroll and does not display the indicators therefore. Try fitting more content inside.