簡體   English   中英

是否可以為工具欄按鈕添加標題,聲明為UIBarButtonSystemItem

[英]Is it possible to add title to toolbar button, declared as UIBarButtonSystemItem

我想在導航工具欄中設置一些按鈕,為了不讓用戶混淆每個按鈕的作用,我想為每個按鈕下方顯示的標題添加標題。 是否有可能做到這一點?

按鈕聲明:

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]];

使用名稱類似閑置示例的圖像

    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];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM