简体   繁体   中英

Is there a way to find all modally presented view controllers in Xcode 11?

I'm updating an app to work with Xcode 11 and iOS 13. It's a big app, and there are a lot of views that are presented modally.

The problem is that with Xcode 11, modal views are by presented as sheet views by default. That means that my users can just dismiss them if they want. I don't want that.

I've searched the Xcode project for:

self.present(

And to each of the view controllers that have been presented in code, I've added:

modalPresentationStyle = .fullScreen

But of course, this only fixes the views that have been presented from code. I have a lot of views that have been presented from storyboards.

Now, I am trying to find if there is a way to search storyboards for all views that have been presented modally.

You can open your storyboards as source code individually in Xcode, or open them all in a text editor like Sublime or Atom. Then you can search for segues that have kind="modal" .

Segues will default to "Same As Destination" for the "Presentation" style so it's often easier to just explicitly set the presentation style of the view controller being presented, which you can specify in the storyboard as well. Change "Presentation" on the view controller from "Automatic" to "Full Screen" (or whatever you want). That way for any view controllers where you don't want them to be presented as popovers, you can ensure they will always be full screen.

Xcode 与目标 segue 演示相同

Xcode 视图控制器演示样式

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