How to add a "Glow" effect to a UIBarButtonItem?

I figured a lot to find out the glow effect for UIBarButtonItem. Now I do, creating a UIButton and creating it as a customView for a UIBarButton. Does anyone have other methods to make it a lot easier? (as a built-in property for UIBarButtonItem)

+3
source share
2 answers

Do you mean the effect that you get when you touch the button? This property is on UIButton (also available from Interface Builder);

@property(nonatomic) BOOL showsTouchWhenHighlighted

So...

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.showsTouchWhenHighlighted = YES;

If you write a subclass of UIBarButtonItem and put this code there somewhere, it is very simple (and not dirty) to reuse it. I am not sure if there is another way.

+8
source

You tried

- (id)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action

UIBarButtonItemStylePlain

0

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


All Articles