Add images to bar button item of toolbar in iphone

Set the button type as custom.

UIButton *button =  [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:[UIImage imageNamed:@"myImage.png"] 
[button addTarget:self action:@selector(blah) 
[button setFrame:CGRectMake(0, 0, 32, 32)];
.navigationItem.rightBarButtonItem =  
[[UIBarButtonItem alloc] initWithCustomView:button];

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>