你可以通过故事板向导航栏添加按钮吗?
问题描述:
目前,我一直在添加以下导航按钮:
At the moment, I've been adding navigation buttons like follows:
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Add"
style:self.editButtonItem.style
target:self
action:@selector(doneButtonPressed)];
不通过故事板添加它们似乎有点傻,但我找不到办法这样做。有没有我缺少的?
It seems a bit silly to not add them through storyboard, but I can't find a way to do so. Is there one that I'm missing?
答
你可以拖出一个Bar Button Item并将其放在右端视图控制器的导航栏:
You can just drag out a Bar Button Item and drop it on the right end of the view controller's navigation bar: