我在 UIViewController 中添加了一个 UIToolBar 并在其中添加了 UIBarButton,还添加了用于在背景中显示图像但不显示图像的代码
这是我的代码
UIBarButtonItem *b1=[[UIBarButtonItem alloc]initWithTitle:@" Home " style:UIBarButtonItemStyleBordered target:self action:@selector(home: )];
[b1 setImage:[UIImage imageNamed:@"b1image.png"]];
UIBarButtonItem *b3=[[ UIBarButtonItem alloc]initWithTitle:@" WorkOuts " style:UIBarButtonItemStyleBordered target:self action:nil];
[b1 setImage:[UIImage imageNamed:@"b3image.png"]];
UIBarButtonItem *b4=[[UIBarButtonItem alloc]initWithTitle:@" All Exercises " style:UIBarButtonItemStyleBordered target:self action:@selector(all:)];
[b1 setImage:[UIImage imageNamed:@"b4image.png"]];
NSArray *li=[[NSArray alloc]initWithObjects:b1,b3,b4, nil];
self.toolBar.items=li;