Is it possible to remove the delay of UIButton's highlighted state inside a UIScrollView?
I have noticed a slight delay on the highlighted state of a UIButton when touched down if it is inside a UIScrollView (or a table view). Otherwise, the highlighted state is pretty much instantaneous.
I surmise this must be by-design to provide a chance for user to scroll. But it just seems like the button is unresponsive to me. Is there a way to fix this?
Solutions Collect From Internet About “Is it possible to remove the delay of UIButton's highlighted state inside a UIScrollView?”
Indeed, it’s a design choice. It needs this small time to differentiate a scroll (panGesture) from a tap. If you eliminate this delay, then the user won’t be able to scroll if he places the finger on top of the button, which is not good user experience.
Because a scroll view has no scroll bars, it must know whether a touch signals an intent to scroll versus an intent to track a subview in the content. To make this determination, it temporarily intercepts a touch-down event by starting a timer and, before the timer fires, seeing if the touching finger makes any movement. If the timer fires without a significant change in position, the scroll view sends tracking events to the touched subview of the content view.
from the UIScrollView Documentation
I wouldn’t recommend disabling the delay, but if you insist, you can set it in interface builder (select the Scroll View, and on the right panel, right under “Bounces Zoom”), or using this code:
scrollView.delaysContentTouches = false
- Too many UILabels with unicode text
- iPad Launch image landscape
- Connect WiFi Network via App
- How to resize a UIModalPresentationFormSheet?
- Open a PDF document on iPhone
- In iOS 5.1 app; Why can't I see the Exception?
- UIActivityIndicatorView inside UIButton
- UITableView – Directly setting tableHeaderView property vs. Implementing -viewForHeaderInSection method
- iOS — detect the color of a pixel?
- UIBezierPath: How to add a border around a view with rounded corners?
- Swift Initialize Struct with optional stored properties
- Xcode 4.3 for Snow Leopard
- Method Syntax in Objective C
- Launch Google maps app from iPhone application.
- Swift: Cannot invoke 'reloadData' with no arguments