3

I tried a lot to find out the glow effect for UIBarButtonItem. Now am doing by creating a UIButton and making it as the customView for the UIBarButton. Do anyone have any other methods to make it much more easier? (like a inbuilt property for UIBarButtonItem)

thoughtbreaker
  • 161
  • 1
  • 10

2 Answers2

8

You mean the effect you get when you touch an button? That is a property on an UIButton (also accessible 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 in there somewhere it is really easy (and not messy) to re-use it. I'm not sure if there is any other way.

Jake
  • 3,973
  • 24
  • 36
  • 1
    friend, I know the method to make the UIButton to glow. The question is how can I add glow effect to the UIBarButton without custonViewing the UIButton to it. – thoughtbreaker Feb 04 '11 at 02:33
0

Have you tried

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

as button style using UIBarButtonItemStylePlain

xxcv
  • 331
  • 2
  • 11