UISplitViewController - Pushing Modal View

What is considered best practice when clicking a modal view when using the UISplitViewController? Would you click on RootViewController, DetailViewController or directly from the application delegate?

Ideally, the functionality I'm trying to achieve is to display a modal view controller as soon as the UISplitViewController is loaded based on certain conditions.

Thanks in advance for any guidance on this.

+4
source share
2 answers

I tried to do the same, and I came up with the following answer: it is easier to do this from the App Delegate.

In portrait mode, the RootViewController is created in a strange way (popover), so it is not practical, the application delegate ensures that your view will be displayed correctly in all cases. I can’t remember what the problem is with doing this in the DetailViewController.

EDIT: the actual implementation in application:didFinishLaunchingWithOptions: looks something like this: [splitViewController presentModalViewController: modalViewController animated: NO]; . Hope this helps!

+1
source

I really ran into the same problem and made this post:

presentModalViewController shifts the new view too far and goes beyond the top of the screen

Basically, when you call a modal view from a detailed view, the program explodes with problems, many of which are related to rotation while viewing the modality.

- = - = - = - = - = -

Bottom line, always invoke the modal view from the root view controller.

0
source

Source: https://habr.com/ru/post/1315342/


All Articles