在我的應用程序中,我添加了兩個導航欄的UIBarButtonItem。在iOS6的和它下面看起來像這樣iOS UIBarButtonItem對齊
但是當我在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;
你能看到這個問題http://stackoverflow.com/questions/18861201/uibar buttonitem-with-custom-view-not-aligned-on-ios-7-when-left-left-left –
@megan你有解決方案....? – Spynet
@Spynet尚未... – Megan