简体   繁体   English

单击当前ViewController中的按钮时,如何显示当前ViewController的精确副本?

[英]How to display exact copy of current ViewController when a button in current ViewController is clicked?

I want to display another ViewController which must be copy of current ViewController with same UI(empty new tab like in Safari) when a button is clicked in current ViewController . 我想显示另一个ViewController ,当在当前ViewController单击按钮时,该ViewController必须是具有相同UI(像Safari中一样为空的新标签)的当前ViewController副本。 For clear understanding, when we click + button iOS Safari then new tab in Safari is opened. 为了清楚理解,当我们单击+按钮iOS Safari时,将打开Safari中的新标签页。 I want to include this feature in my project. 我想在我的项目中包含此功能。

Having a copy loaded is not like a new tab. 加载副本与新建标签不同。 You're looking to create a new instance of the same view controller. 您正在寻找创建相同视图控制器的新实例。 So, just instantiate it again with a new instance variable. 因此,只需使用新的实例变量再次实例化它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 仅在关闭当前ViewController时显示RootViewController - Display RootViewController only when dismiss current ViewController 如何在 Swift 3 中检查当前的 ViewController? - How to check Current ViewController in Swift 3? 在当前的视图控制器下面加载一个视图控制器 - Loading a viewcontroller underneath the current viewcontroller 如何在将当前的ViewController保留在TabBarController中之前显示警报? - How to display an Alert before leaving current ViewController in TabBarController? 如何通过使用Swift单击完成按钮来关闭以前的和当前的视图控制器 - How to dismiss previous and current viewcontroller by click done button using Swift 当应用程序进入前台时如何加载当前的ViewController - How to load the current viewcontroller when application comes to foreground 如何在Swift中关闭当前的ViewController并更改为新的ViewController? - How to dismiss the current ViewController and change to the new ViewController in Swift? 如何在非viewcontroller类中获取可见/当前viewcontroller? 迅速 - How get visible / current viewcontroller in non-viewcontroller class? Swift 获取 ViewController 的当前实例 - Getting the current instance of ViewController 将当前的ViewController添加到NavigationControllerStack - Add current viewcontroller to navigationControllerStack
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM