0

I am developing an app using xcode (Swift) with out using the storyboard but i have a problem when a user logs in to the app they are transferred to the home page but the viewer controller does not reach the top of the screen and when i change to a different tab i can see the login screen in the background.

This is the code i use to get transferred to the home screen once the user logs in:

let mainTabVC = MainTabVC()
self.present(mainTabVC, animated: true,completion: nil)

is there any way to fix this?

mag_zbc
  • 6,801
  • 14
  • 40
  • 62
Gino Sesia
  • 383
  • 2
  • 4
  • 14

1 Answers1

0

You need to set modalPresentationStyle of your controller Apple documentation

 mainTabVC.modalPresentationStyle = .fullScreen

The presentation style determines how a modally presented view controller is displayed onscreen. In a horizontally compact environment, modal view controllers are always presented full-screen. In a horizontally regular environment, there are several different presentation options. The default value for this property is UIModalPresentationStyle.automatic. For a list of possible presentation styles, and their compatibility with the available transition styles, see the UIModalPresentationStyle constant descriptions.

Jawad Ali
  • 13,556
  • 3
  • 32
  • 49