Why does an empty UIScrollView have two subviews?
ios5, objective-c, storyboard, uiscrollview, xcode
Solution
They're the scrollbars (or scroll indicators, if you prefer.) One is horizontal and the other is vertical.
Problem
I have a need to calculate the height of of my content within a UIScrollView. I dropped an empty UIScrollView into the XCode Storyboard, gave it a custom class with this code: ``` - (id)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (self) { int i; for (i = 0; i < [self.subviews count]; i++) { UIView *view =[self.subviews objectAtIndex:i]; NSLog(@"sub view %@ x:%f, y:%f, w:%f, h:%f", [view class], view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height); } } return self; } ``` With an empty UIScrollView this is what logs to the console: ``` sub view UIImageView x:233.000000, y:121.000000, w:7.000000, h:7.000000 sub view UIImageView x:233.000000, y:121.000000, w:7.000000, h:7.000000 ``` What are those images? They throw off my calculations because they are always below my content.