多个在同一个按钮中展开-Swift [英] Multiple unwind in the same button - Swift

查看:188
本文介绍了多个在同一个按钮中展开-Swift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以在同一按钮上分配两种不同的展开方法.例如:

我有以下视图导航:

  • 首页-> A-> B
  • 首页-> C-> B

A和C视图导航到B,但是我想使用相同的B视图和控制器返回到以前的视图.

有可能吗?

我一直在考虑根据视图的出现以编程方式为按钮编写分配取消展开方法.

预先感谢

我很抱歉我的英语不好.

解决方案

尽管,问题还不是很清楚.但是我能理解的是,您想根据用户来自哪里导航回上一个视图,即B> C或B> A.

如果是这样,请检查 UINavigationController .它跟踪导航历史记录,并自动添加后退按钮.有点像我们浏览器中的后退"按钮.

虽然这里有些旧,但这里是一个教程:链接

I would like to know if it is possible to assign two different unwind method at the same button. For example:

I have this views navigations:

  • Home->A->B
  • Home->C->B

A and C views navigates to B, but then I want to return to previous views using the same B view and controller.

It is possible?

I have been thinking about write assign unwind method to the button programmatically depending what view comes.

Thanks in advance

I'm sorry about my english, is not good.

解决方案

Although, question isn't very clear. But what I could understand is that you want to navigate back to the previous view i.e. B>C or B>A depending upon where user came from.

If so, then check the UINavigationController. It keeps track of the navigation history and automatically adds a back button. Kind of like the back button in our browsers.

Here is a tutorial, although a bit old: Link

这篇关于多个在同一个按钮中展开-Swift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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