-2

I am a novice in Swift. I have developed a small application with Xcode10. When I upgrade Xcode 10 to 11 version, all the views changed. Now, I see at the top of all views a small part of my first view (behind). When I scrolled down the view, I see my first view. It will more clear with the picture:

enter image description here

How can I do to avoid that?

koen
  • 5,383
  • 7
  • 50
  • 89
  • 1
    This is happening because you are presenting view controllers. Nothing wrong with the Xcode, it's due to iOS 13's new window approach. you can use following code to present full-screen presentation - `viewControler.modalPresentationStyle = .fullScreen` – Amir Khan Jun 15 '20 at 16:30
  • Thank you at first for your quick answer. Where I put this code? – Yvon Av Jun 15 '20 at 16:44
  • Based on your description, I assume you mean that the window changes appear only iOS 13 - Xcode 11 uses iOS13 in the simulator. If you have iOS devices running iOS 12 or earlier, they wouldn't have this new behavior. – benc Jun 15 '20 at 16:46
  • @YvonAv where depends if you are presenting it programmatically or using the storyboard https://www.appsdissected.com/wp-content/uploads/2019/08/Screen-Shot-2019-08-28-at-11.03.59.png – Leo Dabus Jun 15 '20 at 17:17
  • Thank you for your help. It' OK. I use storyborad – Yvon Av Jun 15 '20 at 18:42

1 Answers1

1

This is the new behavior on iOS 13, you can use the snippet to change it back to full screen.

let vc = UIViewController()
vc.modalPresentationStyle = .fullScreen
self.present(vc, animated: true, completion: nil)

Documentation https://developer.apple.com/documentation/uikit/uimodalpresentationstyle

Rizwan Mehboob
  • 1,333
  • 17
  • 19
  • Thanks, but where I put this code ? In my first/maine swift ViewController or ? – Yvon Av Jun 15 '20 at 17:06
  • Yes, so you have to add it where the current viewController is presented, if possible you can also share your code in you question. – Rizwan Mehboob Jun 15 '20 at 17:08
  • import UIKit class FittingViewController: UIViewController{ // Declaration nom et icon TabBar required init?(coder aDecoder: NSCoder) { super.init(coder:aDecoder) tabBarItem=UITabBarItem(title: "Fittings", image: UIImage(named: "fitting-icon"), tag: 2) } override func viewDidLoad() { super.viewDidLoad() } override func viewWillDisappear(_ animated: Bool) { AppDelegate.AppUtility.lockOrientation(UIInterfaceOrientationMask.all) } } – Yvon Av Jun 15 '20 at 17:17
  • which ViewController is presenting FittingViewController? – Rizwan Mehboob Jun 15 '20 at 17:26