Deepak Kumar
UIBarButtonItem drawrect
1 Answer(s)      6 years and 2 months ago
Posted in : MobileApplications


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



View Answers

January 12, 2011 at 8:26 PM


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)];



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
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
Drawing with Color in Java
below: drawRect(): This is the method of the Graphics class (The Graphics... as the drawRect() method. In this method first come the width and then height...() method of the Graphics class. It also takes argument same as the drawRect() method
Background Image for Navigation Bar
UINavigationBar (CustomImage) - (void)drawRect:(CGRect)rect { UIImage *image
Java - Drawing Shapes Example in java
() : The drawRect() method draws the rectangle. Here is the syntax of the drawRect
Change Button Text iPhone
=[[UIBarButtonItem alloc] initWithTitle:@"HOME" style
iPhone Segments Changes ToolBar And ToolBar Button
]; UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithBarButtonSystemItem...;  UIBarButtonItem *new = [[UIBarButtonItem alloc...;     UIBarButtonItem *item
iPhone NavigationBar With ToolBar
];     UIBarButtonItem *About = [[UIBarButtonItem alloc... = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem
iPhone Switch Changes Toolbar Color
; UIBarButtonItem *list = [[UIBarButtonItem alloc]initWithTitle
Graphics MIDlet Example
;x, 0);   drawRect(z, z, 30, 30); 
iphone TextView
;   UIBarButtonItem* saveItem = [[UIBarButtonItem alloc
iPhone Picker Object On Toolbar Button
;  UIBarButtonItem *systemItem = [[UIBarButtonItem alloc
Delete and add row from Table View iPhone
;;     UIBarButtonItem *addButton = [[UIBarButtonItem
Search bar application
= [[[UIBarButtonItem alloc]