The code example is below.. I made a screenshot when I was clicking the button (the curser is not shown in the screenshot) - and there is no button select effect.
Hence, it seems that the UIToolBar is not drawn properly. There remains a white line at the top and bottom, see here:
http://www.learnclip.com/iPhoneDev/uitoolbar.png. If I am changing the height from 45 to 44, it looks like this:
http://www.learnclip.com/iPhoneDev/uitoolbar2.png
UIToolbar* toolbar = [[UIToolbar alloc]
initWithFrame:CGRectMake(0, 0, 100, 45)];
[toolbar setTintColor:[[UIColor alloc] initWithRed:150.0 green:0.0 blue:0.0 alpha:1]];
// create an array for the buttons
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:3];
// create a standard save button
UIBarButtonItem *saveButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
target:self
action:@selector(bookmark:)];
saveButton.style = UIBarButtonItemStyleBordered;
[buttons addObject:saveButton];
[saveButton release];
// create a spacer between the buttons
UIBarButtonItem *spacer = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nil
action:nil];
[buttons addObject:spacer];
[spacer release];
// create a standard delete button with the trash icon
UIBarButtonItem *deleteButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemSearch
target:self
action:@selector(magnify:)];
deleteButton.style = UIBarButtonItemStyleBordered;
[buttons addObject:deleteButton];
[deleteButton release];
// put the buttons in the toolbar and release them
[toolbar setItems:buttons animated:NO];
[buttons release];
// place the toolbar into the navigation bar
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
initWithCustomView:toolbar];
[toolbar release];