iOS では、バーに 2 つの項目を追加できます。次のコードを試してください。
UIButton *tempButton = nil;
UIImage *tempButtonImage = nil;
UIImage *tempButtonPressedImage = nil;
tempButtonImage = [UIImage imageNamed:@"unselected1.png"];
tempButtonPressedImage = [UIImage imageNamed:@"selected1.png"];
tempButton = [UIButton buttonWithType:UIButtonTypeCustom];
[tempButton setImage : tempButtonImage forState : UIControlStateNormal];
[tempButton setImage : tempButtonPressedImage forState : UIControlStateHighlighted];
[tempButton addTarget : self action : @selector(tempButtonClick:) forControlEvents : UIControlEventTouchUpInside];
tempButton.frame = CGRectMake(0, 0, tempButtonImage.size.width, tempButtonImage.size.height);
UIView *tempButtonContainer = [[UIView alloc] initWithFrame:(CGRect){0.0, 0.0, tempButtonImage.size.width, tempButtonImage.size.height}];
tempButtonContainer.backgroundColor = [UIColor clearColor];
[tempButtonContainer addSubview:tempButton];
UIBarButtonItem *tempToolbarButton = [[UIBarButtonItem alloc] initWithCustomView:tempButtonContainer];
// custom logout button
UIButton *temp2Button = nil;
UIImage *temp2ButtonImage = nil;
UIImage *temp2ButtonPressedImage = nil;
temp2ButtonImage = [UIImage imageNamed:@"unselectedtemp2Button.png"];
temp2ButtonPressedImage = [UIImage imageNamed:@"selectedtemp2Button.png"];
temp2Button = [UIButton buttonWithType:UIButtonTypeCustom];
[temp2Button setImage : temp2ButtonImage forState : UIControlStateNormal];
[temp2Button setImage : temp2ButtonPressedImage forState : UIControlStateHighlighted];
[temp2Button addTarget : self action : @selector(temp2ButtonClick:) forControlEvents : UIControlEventTouchUpInside];
temp2Button.frame = CGRectMake(0, 0, temp2ButtonImage.size.width, temp2ButtonImage.size.height);
UIView *temp2ButtonContainer = [[UIView alloc] initWithFrame:(CGRect){0.0, 0.0, temp2ButtonImage.size.width, temp2ButtonImage.size.height}];
temp2ButtonContainer.backgroundColor = [UIColor clearColor];
[temp2ButtonContainer addSubview:temp2Button];
UIBarButtonItem *temp2ToolbarButton = [[UIBarButtonItem alloc] initWithCustomView:temp2ButtonContainer];
// setting right items
self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:tempToolbarButton, temp2ToolbarButton, nil];
UIButton *button = nil;
UIImage *buttonImage = nil;
UIImage *buttonPressedImage = nil;
buttonImage = [UIImage imageNamed:@"asd.png"];
buttonPressedImage = [UIImage imageNamed:@"selected-asd.png"];
button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage : buttonImage forState : UIControlStateNormal];
[button setImage : buttonPressedImage forState : UIControlStateHighlighted];
[button addTarget : self action : @selector(buttonClick:) forControlEvents : UIControlEventTouchUpInside];
button.frame = CGRectMake(0, 0, buttonImage.size.width, buttonImage.size.height);
UIView *buttonContainer = [[UIView alloc] initWithFrame:(CGRect){0.0, 0.0, buttonImage.size.width, buttonImage.size.height}];
buttonContainer.backgroundColor = [UIColor clearColor];
[buttonContainer addSubview:button];
UIBarButtonItem *toolbarButton = [[UIBarButtonItem alloc] initWithCustomView:buttonContainer];
self.navigationItem.leftBarButtonItem = toolbarButton;