Swift version: 5.1
If you want an easy way to let users know when a
UIButton was tapped, try setting its
showsTouchWhenHighlighted property to be true. This will render a circular glow effect behind the button when it's tapped, which is particularly effective on text-only buttons.
Here's the code:
btn.showsTouchWhenHighlighted = true
If you're using Interface Builder, look for and check the "Shows touch when highlighted" option for your button.
SAVE 20% ON iOS CONF SG The largest iOS conference in Southeast Asia is back in Singapore for the 5th time in January 2020, now with two days of workshops plus two days of talks on SwiftUI, Combine, GraphQL, and more! Save a massive 20% on your tickets by clicking on this link.
Available from iOS 2.0
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.