Xcode/Swift:如何实现后退按钮? [英] Xcode / Swift: How I implement a back button?

查看:230
本文介绍了Xcode/Swift:如何实现后退按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用Xcode和Swift.

I just started with Xcode and Swift.

我尝试为iOS构建我的第一个小应用程序.但是现在我有一个问题,就是我不知道如何实现后退按钮,因此我回到了以前的视图.

I try to build my first little App for iOS. But now I have the problem, that I don't know how to implement a the back button, so that i come back to the view before.

我的情节提要板看起来像这样:

My Storyboard look like this:

当我打开A-Z视图时,我想显示后退箭头",这会将我带回到项目2视图.

When I open the A-Z view, I want to display the Back Arrow, which turn me back to the Item 2 view.

要打开A-Z视图,请在导航控制器上连接按钮"Medikamente A-Z".

To open the A - Z view I connect the button "Medikamente A - Z" with the Navigation Controller.

推荐答案

在使用情节提要时,后退按钮通常是通过松开键来实现的.

When using storyboards the back button is usually implemented with unwind segue.

我通常喜欢在与UI相关的主题上关注raywenderlich演讲,例如- http://www.raywenderlich.com/113394/storyboards-tutorial-in-ios-9-part-2

I usually like to follow raywenderlich toturials on UI related topics, like this - http://www.raywenderlich.com/113394/storyboards-tutorial-in-ios-9-part-2

它包括如何在情节提要中实现后退按钮的详细示例.引用-

It include a detailed example of how to implement back button in storyboards. Quoting from it -

故事板提供了放松"功能的返回"功能,接下来将执行该功能. 主要包括三个步骤: 1.创建一个供用户选择的对象,通常是一个按钮. 2.在要返回到的控制器中创建一个展开方法. 3.将方法和对象连接到情节提要中.

Storyboards provide the ability to ‘go back’ with something called an unwind segue, which you’ll implement next. There are three main steps: 1. Create an object for the user to select, usually a button. 2. Create an unwind method in the controller that you want to return to. 3. Hook up the method and the object in the storyboard.

这篇关于Xcode/Swift:如何实现后退按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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