我想在导航工具栏中设置一些按钮,并且为了让用户不要对每个按钮的作用感到困惑,我想为每个按钮添加标题,在其下面显示。是否有可能做到这一点?
按钮声明:
UIBarButtonItem *changeFiltersButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refreshButton)] autorelease];
``...
[self setToolbarItems:[NSArray arrayWithObjects: flexible,
changeFiltersButton, flexible, flexible,
refreshFiltersList, flexible, flexible,
more, flexible, nil]];
答案 0 :(得分:0)
使用名称如下图所示的图像
NSMutableArray *toolBaritems = [[NSMutableArray alloc] init];
[toolBaritems addObject:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]];
[toolBaritems addObject:[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"img.png"] style:UIBarButtonItemStylePlain target:self action:@selector(refresh)]];
[toolBaritems addObject:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]];
[toolBaritems addObject:[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"img2.png"] style:UIBarButtonItemStylePlain target:self action:@selector(change)]];
[toolbar setItems:toolBaritems animated:NO];