更新:iOS 5的支持在同一側上多個按鈕。從UINavigationItem文檔:
自定義視圖
titleView property
leftBarButtonItems property
leftBarButtonItem property
rightBarButtonItems property
rightBarButtonItem property
– setLeftBarButtonItems:animated:
– setLeftBarButtonItem:animated:
– setRightBarButtonItems:animated:
– setRightBarButtonItem:animated:
所以,基本上,你會寫這樣的事情在左邊添加兩個按鈕:
UIBarButtonItem *refreshBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refreshPlans:)];
UIBarButtonItem *selectYearBtn = [[UIBarButtonItem alloc] initWithTitle:@"Select Year" style:UIBarButtonSystemItemAction target:self action:@selector(selectYear)];
self.navigationItem.leftBarButtonItems = [[NSArray alloc] initWithObjects: refreshBtn, selectYearBtn, nil];
不幸的是,我的天堂」沒有看到在故事板中執行此操作的方法。希望這可以幫助。