0

Is there a way to customize navigation button, segment button background like iBooks?

Check out iBooks shelf top left corner. the button background is about 50% transparent. What a pretty!

Any one konw how to emplement it?

All Regards

Allendog
  • 322
  • 2
  • 7

1 Answers1

0

It looks to me as though it's a UIButton with an alpha of say, 0.5, ontop of a UINavigationbar with a custom background.

Try dropping something like this into your appDelegate.m

@implementation UINavigationBar (UINavigationBarCategory)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"navigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end

Alternatively you could drop in a method here,

And when you add your button to the Navigation bar..

button.alpha = 0.5;

Hope that helps

Amal T S
  • 3,327
  • 2
  • 24
  • 57
Bongeh
  • 2,300
  • 2
  • 18
  • 30
  • I recommend using an image with 50% transparency, not setting the button.alpha. In the latter case, the label or foreground image is affected by the alpha as well. – Ortwin Gentz Aug 13 '10 at 10:37
  • Thanks for great comments. I think button.alpha will affect button's text transparency, that's not I want. Let me try transparent background image. Again. Thanks Bongeh and Ortwin. – Allendog Aug 15 '10 at 08:01