ios - 取消按钮而不是导航 Controller 中的后退按钮

标签 ios xcode swift storyboard uibarbuttonitem

我有一个关于 View 之间导航的一般性问题。

我有一个嵌入在导航 Controller 中的 View Controller 1。在导航栏中,我有一个按钮来添加数据,按下时,它会通过 segue Show(在 Storyboard 中)转到 View Controller 2。在 View Controller 2 中,当我单击右侧导航栏中的保存按钮时,我在收集数据后返回到 View Controller 1。我收集数据:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {...}

我宁愿在 View Controller 2 中使用取消按钮来返回到 View Controller 1,而不是后退按钮。

我觉得我的设计有问题,但我不知道是什么。

事实上,我正在寻找与应用程序时钟非常相似的东西。

你有什么想法吗?

编辑:这是 Storyboard。你会注意到两个 Controller 之间的循环。当我点击保存时第一个 Controller 上没有自动返回按钮怎么办?

Storyboard

最佳答案

您只需选择 UIBarButtonItem,单击“显示属性检查器”,单击“标识符”并从下拉菜单中选择“取消”。

enter image description here

enter image description here

@IBAction func cancelDownload(sender: AnyObject) {
    dismissViewControllerAnimated(true, completion: nil)

}

关于ios - 取消按钮而不是导航 Controller 中的后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28749848/

相关文章:

swift - 为什么我的通知没有被触发?

ios - 我认为无法使用适用于 IOS 的 Google Maps API 绘制多边形

android - Android 和 iOS 崩溃报告的分类和分组

c# - 无法导航到 RowSelect 上的 ViewController

ios - 读取存储在 Xcode 项目中的文件

node.js - 类型错误 : Cannot read property 'save' of null when PUT-ing in swift

iOS 搜索栏置换

ios - TableView 滚动问题与内容偏移

ios - 提交给 Apple : XCode "submit" or Application Loader?

ios - 显示弹出窗口后删除 UITextField 文本