向导航控制器添加按钮 [英] Adding buttons to navigation controllers

查看:45
本文介绍了向导航控制器添加按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 swift 3 xcode 8 项目中工作,但我遇到了一个问题.

I am working in a swift 3 xcode 8 project, and I have an issue.

我有一些视图控制器.在第一个中,我插入了一个导航控制器,当我在另一个视图控制器中时,它给了我后退"按钮.所以我可以继续回到第一个视图控制器.

I have some view controllers. In the first one I've inserted a navigation controller, which gives me the "back" button when I am in another view controller. So I can go on and back to the first viewcontroller.

问题是,让我们说,当我在第三个视图控制器中时,我想插入一个按钮,但只出现在导航控制器的这个视图控制器中.

The thing is, lets say, when I am in the third view controller I'd like to insert a button, but appearing just in this viewcontroller in the navigation controller.

我已经尝试添加一个条形按钮项,但它不起作用,因为导航控制器只出现在故事​​板中,在我的第一个视图控制器中.

I've tried adding a bar button item but it doesnt work because the navigation controller only appears, in the storyboard, in my first viewcontroller.

那么如何在另一个 viewcontrollerS 中向导航控制器添加按钮?

So how can I add buttons to the navigation controller, in another viewcontrollerS?

推荐答案

那么如何在另一个 viewcontrollerS 中向导航控制器添加按钮

So how can I add buttons to the navigation controller, in another viewcontrollerS

将导航项拖到您的第三个视图控制器中.现在您可以向其中添加栏按钮项目.

Drag a Navigation Item into your third view controller. Now you can add bar button items to that.

这篇关于向导航控制器添加按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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