I'm trying to adjust my subviews
in a UIScrollView
subclass, but I don't want to disturb the scroll indicators. There doesn't seem to be any public interface to access these and I want to check if a view is one of the scroll indicators or not (so that I can ignore it).
UIScrollView.h
declares these two iVars:
UIImageView* _verticalScrollIndicator;
UIImageView* _horizontalScrollIndicator;
...but I tried the following and got a linker error:
for(UIView* v in self.subviews)
{
// Ignore the scroll-indicator views
if( (v == _horizontalScrollIndicator) ||
(v == _verticalScrollIndicator))
{
continue;
}
// View is one of mine - do stuff to it...
}
Apple obviously don't want you messing with these, in which case they should do something clever so that the array returned from subviews
doesn't include them (come on Apple, it's not that hard!), but until then how can I ignore them?
Scroll View is used for displaying content more than the size of the screen. It can contain all of the other UI elements like image views, labels, text views and even another scroll view itself.
Overview. UIScrollView is the superclass of several UIKit classes, including UITableView and UITextView . A scroll view is a view with an origin that's adjustable over the content view. It clips the content to its frame, which generally (but not necessarily) coincides with that of the app's main window.
This ended up being my work-around
BOOL showsVerticalScrollIndicator = self.showsVerticalScrollIndicator;
BOOL showsHorizontalScrollIndicator = self.showsHorizontalScrollIndicator;
self.showsVerticalScrollIndicator = NO;
self.showsHorizontalScrollIndicator = NO;
// loop through self.subviews here
self.showsVerticalScrollIndicator = showsVerticalScrollIndicator;
self.showsHorizontalScrollIndicator = showsHorizontalScrollIndicator;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With