One of the Apple Human Interface Guideline says:
Provide ample touch targets for interactive elements. Try to maintain a minimum tappable area of 44pt x 44pt for all controls.
(https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/adaptivity-and-layout/)
But sometimes, your graphic designer only gives you a tiny image and:
- you don’t want to deal with the button insets in your layout
- you still want your users to have a reasonable hit zone
The solution is to override the func hitTest(_:, with:) -> UIView?
method of the UIButton, so that it returns said button even if the tap if slightly out of bounds (as long as this matches the 44×44 points rule):