Domanda

When you tap a button it should go into its highlighted state right? Kind of darkening the texture automatically to give it the press effect. The problem I have is that this is working nice, but only after I drag inside the button, or on some buttons, when I hold the click for a while. If I tap it fast, it does the function hooked to it, but it doesn't go into highlighted state, or it does but it doesn't show. This is really irritating because it makes it look like the button is not pressed when it really is. Any help would be greatly appreciated.

edit: i found the problem, it was due to having a swipe drag gesture receiver in that view, after removing it it worked like a charm!

È stato utile?

Soluzione

Something further up the view hierarchy will be interfering with your tap gesture.

For UIButtons embedded in a UIScrollView, the scroll view purposely delays touches in order to differentiate a user's pan gesture (scroll) from a tap (which it will pass through to it's subviews).

You can eliminate this delay by setting thedelaysContentTouches property on the scroll view to NO, either in code or via the Scroll View > Touches section in the IB/ Storyboard inspector. However, doing so means the user won't be able to scroll if they start the pan gesture with their finger on the button, so it's generally not recommended.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top