你可以通过故事板向导航栏添加按钮吗? [英] Can you add buttons to navigation bars through storyboard?

查看:108
本文介绍了你可以通过故事板向导航栏添加按钮吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我一直在添加以下导航按钮:

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:

这篇关于你可以通过故事板向导航栏添加按钮吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆