简体   繁体   English

如何删除后台的第一个ViewController?

[英]How To Remove The First ViewController In The Background?

I have two view controllers, first view controller and the second view controller, when the user segue from the first view controller to the second view controller, the first view controller still visible and sits behind the second view controller.我有两个视图控制器,第一个视图控制器和第二个视图控制器,当用户从第一个视图控制器转到第二个视图控制器时,第一个视图控制器仍然可见并位于第二个视图控制器后面。 The user can swipe the first view controller and see the entire first view controller and then they got stuck there.用户可以滑动第一个视图控制器并看到整个第一个视图控制器,然后他们就卡在那里了。 I noticed that this only happens after the launch of iOS 13.我注意到这只会在 iOS 13 发布之后发生。

performSegue(withIdentifier: "showSecond", sender: self)

在此处输入图片说明

Follow these two steps:请按照以下两个步骤操作:

  1. Click on the segue you created on the Storyboard单击您在 Storyboard 上创建的 segue
  2. Go to Attributes Inspector转到属性检查器
  3. Set the Presentation to "Full Screen"演示文稿设置为“全屏”

在此处输入图片说明

@Maysam is 100% right! @Maysam 是 100% 正确的! But you can also do it programmatically through this:但是您也可以通过以下方式以编程方式执行此操作:

  // Go to next View Controller
@IBAction func nextTextVC(_ sender: UIButton) {

    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let nextInfo = storyboard.instantiateViewController(identifier: "socialOptionsIntroViewController")
    self.navigationController?.pushViewController(nextInfo, animated: true)
        }

There is a more detail thread could answer this question.有一个更详细的线程可以回答这个问题。

The follow solution from Pratik Sodha来自 Pratik Sodha 的以下解决方案

let controller = UIViewController()
let navigationController = UINavigationController(rootViewController: controller)
navigationController.modalPresentationStyle = .overCurrentContext
self.navigationController?.present(navigationController, animated: true, completion: nil)

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

相关问题 如何删除以前的ViewController - How to Remove a Previous ViewController go如何回到第一个ViewController? - How to go back to the first ViewController? 如何从viewController中删除边距? - How to remove margin from a viewController? 当我仍然可以看到背景viewController时,如何呈现viewController - How to present viewController while I can still see the background viewController 如何将一个ViewController或View加载到具有透明背景的另一个ViewController中? - How can I load a ViewController or View into another ViewController with transparent background? 如何在仍然看到背景viewController的同时显示viewController - How could I present a viewController while still see the background viewController 如何将第一个简单的单视图viewController更改为导航viewController? - How to change first simple singleview viewController to navigation viewController? 我如何从第三个viewController回到第一个viewController - How can I go back to the first viewController from the third viewController 如何实例化第二个ViewController并停止第一个ViewController的方法 - How to instantiate a second ViewController and stop the methods of the first ViewController 如何将文本字段数据从第三个ViewController传递到第一个ViewController - How to pass textfield data from third viewcontroller to first viewcontroller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM