UIBarButtonItem drawrect

UIBarButtonItem drawrect

Hi,

I have to customize UIBarButtonItem background color. Please share me good code.

Thanks

View Answers

January 12, 2011 at 8:26 PM

Hi,

You can use the following code:

@implementation UIBarButtonItem (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

Thanks









Related Tutorials/Questions & Answers:
UIBarButtonItem drawrect
UIBarButtonItem drawrect  Hi, I have to customize UIBarButtonItem background color. Please share me good code. Thanks
UIBarButtonItem Refresh
UIBarButtonItem Refresh  Is it possible to create UIBarButtonItem...;Generally, UIBarButtonItem is placed on either navigation bar or tool bar... the refresh button... i'm providing you the example of Navigation Refresh UIBarbuttonItem
Advertisements
add uibarbuttonitem to uinavigationbar
add uibarbuttonitem to uinavigationbar  add uibarbuttonitem to uinavigationbar
Add multiple UIBarButtonItem
Add multiple UIBarButtonItem  add multiple uibarbuttonitem
uibarbuttonitem initwithcustomview action
uibarbuttonitem initwithcustomview action  HI, Can anyone provide me the code for uibarbuttonitem initwithcustomview action? In my application I am adding custom BarButtonItem, how I can attach an action to it? Thanks
Background image UIBarButtonItem
to my UIBarButtonItem.. that i created into .xib in my iPhone application.   Set the background image to UIBarButtonItem UIBarButtonItem *btn...]; UIBarButtonItem *btn [self.btn initWithCustomView:backButton
uitoolbar not showing
and UIBarButtonItem programmatically //create toolbar using new toolbar = [UIToolbar new... UIBarButtonItem *systemItem1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem...:)]; UIBarButtonItem *systemItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem
unrecognized selector sent to instance
created a UIBarbuttonItem to facilitate the emailing feature for user. But somehow on clicking the UIBarButtonItem, following error messages thrown by the application...: UIBarButtonItem *emailButton = [[UIBarButtonItem alloc] initWithTitle
add a UIButton to UINavigationBar
a UIBarButtonItem to your UINavigationBar in iPhone navigation based application. self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back
uinavigationcontroller add right button
]; UIBarButtonItem *myButton = [[UIBarButtonItem alloc] initWithTitle:@"Show" style
uinavigationcontroller background image
)drawRect:(CGRect)rect; @end //and in .m file #import "MyToolbar.h" @implementation MyToolbar - (void)drawRect:(CGRect)rect { backgroundImage = [UIImage
UIPopOverController - Open a second PopOverController over first UIPopOverController
is called on UIBarButtonItem click that is placed in the UIToolBarItem.  ... a UIButton or other control that isn't a UIBarButtonItem use
Background Image for Navigation Bar
@implementation UINavigationBar (CustomImage) - (void)drawRect:(CGRect)rect
Drawing with Color in Java
the various methods to draw shapes on the screen. The drawRect() is the method... the dynamic methods to calculate the values and then pass to the drawRect... will get screen shown below below: ADS_TO_REPLACE_2 drawRect
Change Button Text iPhone
: self.navigationItem.backBarButtonItem =[[UIBarButtonItem alloc] initWithTitle:@"HOME" style
Java - Drawing Shapes Example in java
); Graphics.drawRect() : The drawRect() method draws the rectangle. Here is the syntax of the drawRect() method :  g.drawRect(int X_coordinate, int Y_coordinate
iPhone Segments Changes ToolBar And ToolBar Button
]; ADS_TO_REPLACE_12 UIBarButtonItem *item = [[UIBarButtonItem...; item.style = style;  UIBarButtonItem *new = [[UIBarButtonItem alloc] initWithTitle:@"Item" style
iPhone NavigationBar With ToolBar
; UIBarButtonItem *About = [[UIBarButtonItem alloc] initWithTitle:@"About"... = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target
iPhone Switch Changes Toolbar Color
UIBarButtonItem *list = [[UIBarButtonItem alloc]initWithTitle
Graphics MIDlet Example
;- x, x, 0);   drawRect(z, z, 30
iphone TextView
;   UIBarButtonItem* saveItem = [[UIBarButtonItem alloc
iPhone Picker Object On Toolbar Button
;  UIBarButtonItem *systemItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:mItem    
Delete and add row from Table View iPhone
UIBarButtonItem *addButton = [[UIBarButtonItem alloc

Ads