File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ - (void)_roundedButtonCommonInit TOROUNDEDBUTTON_OBJC_DIRECT {
154154
155155 // Create action events for all possible interactions with this control
156156 [self addTarget: self action: @selector (_didTouchDownInside ) forControlEvents: UIControlEventTouchDown|UIControlEventTouchDownRepeat];
157- [self addTarget: self action: @selector (_didTouchUpInside ) forControlEvents: UIControlEventTouchUpInside];
157+ [self addTarget: self action: @selector (_didTouchUpInside:event: ) forControlEvents: UIControlEventTouchUpInside];
158158 [self addTarget: self action: @selector (_didDragOutside ) forControlEvents: UIControlEventTouchDragExit|UIControlEventTouchCancel];
159159 [self addTarget: self action: @selector (_didDragInside ) forControlEvents: UIControlEventTouchDragEnter];
160160}
@@ -339,11 +339,16 @@ - (void)_didTouchDownInside {
339339 [self _setButtonScaledTappedAnimated: YES ];
340340}
341341
342- - (void )_didTouchUpInside {
342+ - (void )_didTouchUpInside : ( id ) sender event : (UIEvent *) event {
343343 _isTapped = NO ;
344344
345- // Play the impact.
346- [_impactGenerator impactOccurred ];
345+ // Play the impact to lock in that the user committed to this action.
346+ if (@available (iOS 17.5 , *)) {
347+ const CGPoint touchPoint = [event.allTouches.anyObject locationInView: self ];
348+ [_impactGenerator impactOccurredAtLocation: touchPoint];
349+ } else {
350+ [_impactGenerator impactOccurred ];
351+ }
347352
348353 // The user lifted their finger up from inside the button bounds
349354 [self _setLabelAlphaTappedAnimated: YES ];
You can’t perform that action at this time.
0 commit comments