放松segue不工作iOS swift [英] Unwind segue not working iOS swift

查看:87
本文介绍了放松segue不工作iOS swift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天,



这可能是一个愚蠢的问题,但我只是在3周前开始使用swift。我正在使用SWRevealViewController在我的应用程序上显示菜单。从这个菜单我将根据选择去一个特定的视图控制器。从那个选定的视图控制器,我想放松回主视图控制器(在启动应用程序时打开)。



如何达到展开方法,但没有任何反应?



我必须说unwind方法在Objective-C类中,因为SWRevealViewController是用objective-c编写的,而我的应用程序是用Swift编写的。我有桥接头。根据

Good day,

This may be a dumb question, but I only started with swift about 3 weeks ago. I am using SWRevealViewController to display a menu on my app. From this menu I am going to a certain view controller based on selection. From that selected view controller I would like to unwind back to the main view controller (Which is opened when launching the app).

How is it that the unwind method is reached, but nothing happens?

I must say that the unwind method is in an Objective-C class since the SWRevealViewController is written in objective-c and my app is written in Swift. I have bridging headers in place. Method is reached according to

printf("Unwind Method Called");





我们非常感谢任何帮助。



我尝试了什么:



我在故事板中实现了展开方法和正确连接的所有内容。我甚至在unwind方法下添加了一行打印到控制台并进行打印。但是,视图控制器不会重定向到第一个。

in the unwind method.

Any help would be greatly appreciated.

What I have tried:

I implemented the unwind methods and everything connected correctly in storyboard. I even added a line to print to the console under the unwind method and it prints. However, the view controller is not redirected to the first one.

推荐答案

在您的情况下,我认为您不会忽视视图。



你能告诉我代码,你是如何从第一个开始转向第二个的。



例如:如果使用这个



In your case, I think your are not dismissing the view.

Can you show me the code, that how you are moving to second one from first.

Example : If using this

self.present(ViewController, animated: false, completion: nil)





然后你需要在后退按钮上添加以下代码或提交任何回来。





then you need to add below code on back button or submit whatever for coming back.

dismiss(animated: false, completion: nil)





希望这可能会有所帮助。



Hope this may help.


这篇关于放松segue不工作iOS swift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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