Reputation: 5896
I have a UIScroll view with content in it. If that content overflows, making the scroll view scrollable, I'd like to set the bottom of the view to be a certain color. If it does not, I'd like to set it to a different color.
My issue is, I do not know how to detect if a UIScrollView's content overflows and thus is scrollable.
Upvotes: 5
Views: 1780
Reputation: 1375
I know it's an old question, but my scroll view had a content insets set which made the accepted answer slightly off. Here's how to take the content inset into account:
if scrollView.contentSize.height + scrollView.contentInset.bottom > scrollView.bounds.size.height {
// Scroll view is able to scroll.
}
Upvotes: 0
Reputation: 12053
Check if the scroll view's contentSize
is bigger than its bounds
.
Upvotes: 14