在我的应用程序中,我添加了两个带有导航栏的 UIBarButtonItem。在iOS6及以下它看起来像这样
但是当我在 iOS7 中运行我的应用程序时,它看起来像
问题是:刷新按钮关闭。所以请帮我显示刷新按钮等于“今天”按钮。下面是我正在使用的代码,
UIBarButtonItem* todayButton = [[UIBarButtonItem alloc] initWithTitle:@"Today"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(showTodayAction:)];
UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
target:self
action:@selector(refreshAction:)];
refreshButton.style = UIBarButtonItemStyleBordered;
UIBarButtonItem *negativeSeperator = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nil
action:nil];
negativeSeperator.width = -12;
TransparentToolbar *toolbar = [[TransparentToolbar alloc] initWithFrame:CGRectMake(0, -5, 100, TOOLBAR_HEIGHT)];
toolbar.items = [NSArray arrayWithObjects:
negativeSeperator,
refreshButton, todayButton,
negativeSeperator,
nil];
UIView *toolbarView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, TOOLBAR_HEIGHT)];
[toolbarView addSubview:toolbar];
UIBarButtonItem *toolbarItem = [[UIBarButtonItem alloc] initWithCustomView:toolbarView];
self.navigationItem.leftBarButtonItem = toolbarItem;