iphone custom navigation bar edit button

Posted by Sarah on Stack Overflow See other posts from Stack Overflow or by Sarah
Published on 2010-05-13T14:48:41Z Indexed on 2010/05/13 14:54 UTC
Read the original article Hit count: 968

Filed under:
|

Hi all,

I use custom image for my navigation bar buttons using the following code, that allows me to make custom add button. I want to be able to do the same for the edit button item.

UIImage *image=[UIImage imageNamed:@"Plus.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.bounds = CGRectMake( 0, 0, image.size.width, image.size.height );    
[button setBackgroundImage:image forState:UIControlStateNormal];
[button addTarget:self action:@selector(add) forControlEvents:UIControlEventTouchUpInside];    
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.rightBarButtonItem = barButtonItem;
[barButtonItem release];

self.navigationItem.leftBarButtonItem = self.editButtonItem;

I'm doing this because I want to change the button text color.I would appreciate your help,

Sarah

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uinavigationbar