views:

79

answers:

1

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

A: 

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

Bongeh
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
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