
Hi,
How to set background image of UIToolBar? Give me code for adding UIToolBar's background image.
Thanks

HI,
The easiest way is to use the following code:
[toolBar insertSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.png"]] autorelease] atIndex:0];
Thanks

HI,
Another solution: Add following line of code in yourappdeligate.m or the yourcontroller.m file:
@implementation UIToolbar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"toolbar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
Basically in the above code we are reimplementing the draw method of UIToolbar class.
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.