UIButton inside UIBarButtonItem discards animation effect

If I insert a UIButton inside a UIBarButtonItem to place it on the toolbar, it discards the animation effect when I click it.

iOS 7 by default has a nice animating effect when you click on UIBarButtonItem . It fades slightly to a lighter color.

How can I save this with joy even on custom UIBarButtonItem with background images?

+6
source share
1 answer

I had the same problem when I created several rightbarbuttonitems with a custom UIView and image. I solved my problem using the showsTouchWhenHighlighted property.

  yourCustomButton.showsTouchWhenHighlighted = YES; 
-1
source

Source: https://habr.com/ru/post/955309/


All Articles