Can I use a UIRefreshControl in a UIScrollView?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Yes, you can use UIRefreshControl with UIScrollView, and this is a common pattern for pull to refresh outside table views. The exact integration depends on iOS version and whether you use plain UIKit or custom scroll layouts. A clean setup attaches the refresh control once, triggers async reload, then ends refreshing on the main thread.
iOS Behavior and Supported Approaches
For modern iOS, UIScrollView supports refreshControl directly. For older compatibility targets, developers used addSubview on the scroll view.
Modern style:
Compatibility style:
If your app supports only recent iOS versions, prefer the property based API for clarity.
Basic Implementation in a View Controller
This example works with plain UIScrollView and vertical content.
Ensure Refresh Gesture Can Trigger
Pull to refresh requires enough vertical scroll interaction. If content is shorter than viewport, set always bounce vertical.
Without this, users may not be able to drag enough to trigger refresh on short content.
Integrating with Async Network Calls
Refresh handlers should:
- start network request
- update UI state on success or failure
- call
endRefreshingon main thread
A typical pattern uses async tasks or completion handlers with weak self capture to avoid retain cycles.
Visual and UX Considerations
Keep refresh interaction predictable:
- avoid nested scroll views competing for gesture ownership
- show clear loading feedback if refresh takes longer than one second
- prevent duplicate concurrent refresh requests
Simple guard:
This avoids stacked requests during aggressive pull gestures.
Common Pitfalls
A common pitfall is forgetting endRefreshing, leaving spinner active forever and confusing users.
Another issue is running UI updates from background queue after network completion. Always return to main thread before changing views.
A third issue is disabling vertical bounce on short content, which makes refresh gesture appear broken.
Teams also place UIRefreshControl on inner views inside the scroll hierarchy instead of the scroll view itself, which can break gesture behavior.
Summary
UIRefreshControlworks withUIScrollViewand is widely used- Use
scrollView.refreshControlin modern iOS projects - Set
alwaysBounceVerticalfor short content pull support - End refreshing on main thread after async work completes
- Avoid nested scroll conflicts and duplicate refresh requests

