简体   繁体   中英

View controllers present modally in storyboard, even while turned off

I have a problem in xcode which has been happening for while now, the problem is that even when I turn off the navigation bar in the navigation controller it still presents the view modally in the storyboard. like so: 在此处输入图像描述

so this fixes it in the simulator, you cant see the present modally or navigation bar, but in the story board it does. this makes it hard to set contraints and is an eye sore to me. the fix for this will be greatly appreciated! following images are 1, the present modally shown in the storyboard and 2, the present modally not showing in the simulator: 在此处输入图像描述

在此处输入图像描述

Follow this steps to solve your problem:

  1. Select your storyboard segue
  2. Go to " Attributes inspector " (right panel in xcode)
  3. Change value of " Presentation " attribute to " Current Context "

In storyboard you'll found that the presenting layer is removed and the ViewController's View is occupying the whole screen.

Look at the image here, it'll help you out easily and visually.

Presentation设置为Current Context ,VC 将像NavigationController一样显示在 IB 中

Well it's an ios 13 thing and the default presentation style for xcode 11 is now automatic (previously current context ). Just select the segue of that view controller in storyboard then go to Attributes inspector and you will find the Presentation with automatic as selected, simply change it to Current context and you're good. :)

In case, if you don't find Presentation under Attributes Inspector of the segue, It can found under View Controller -> Attributes Inspector

Verified in XCode 12.4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM