我在导航栏中添加了图像,需要添加右栏刷新按钮。但是添加后右栏按钮无法在导航中显示。为什么?
这里的代码在导航栏添加图像:
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"topbar.png"] forBarMetrics:UIBarMetricsDefault];
这里添加右栏按钮viewDidLoad
:
UIBarButtonItem *refreshItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh: )];
NSArray *actionButtonItems = @[refreshItem];
self.navigationController.navigationItem.rightBarButtonItems = actionButtonItems;