我有下面的代碼:無法將rightBarButtonItem添加到一個UIViewController
- (id) initWith...{
if (self == [super initWithNibName:@"EmptyViewController"
bundle:[NSBundle mainBundle]]){
...
back_btn = [[UIBarButtonItem alloc] initWithTitle:@"Back"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(backParentViewController)];
self.navigationItem.leftBarButtonItem = back_btn;
update_btn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
target:self action:@selector(refresh)];
self.navigationItem.rightBarButtonItem = update_btn;
self.title = [utils LabelFromKey:@"commons.nav-button.reports"];
self.navigationItem.title = [utils LabelFromKey:@"commons.nav-button.reports"];
}
但rightBarButton是不可見的。
我嘗試將代碼移植到viewDidLoad中,並設置按鈕將navigationController.navigationItem但不顯示按鈕
self.navigationController.navigationItem.rightBarButtonItem = update_btn;
任何建議¿?
謝謝
你導航控制器? – Nekto