UISplitViewController - Pushing Modal View

∥☆過路亽.° 提交于 2019-12-06 03:19:38

问题


What is considered the best practise when pushing a modal view when using a UISplitViewController? Would you push from the RootViewController, the DetailViewController or directly from the Application Delegate?

Ideally the functionality I am trying to achieve is to have the modal view controller displayed as soon as the UISplitViewController is loaded based on certain conditions.

Thanks in advance for any pointers on this matter.


回答1:


I was trying to do the exact same thing, and I've come up with the following answer: it's simpler to do it from the App Delegate.

In Portrait mode, the RootViewController is created in a strange way (popover) so it's not practical, the Application Delegate ensures your view will show properly in all cases. I can't remember what was the issue with doing it in the DetailViewController though.

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




回答2:


I actually ran across the same issue and made this post:

presentModalViewController slides a new view too far up and goes above the top of the screen

Basically, when you call a modal view from the detail view, the program explodes with problems with many to do with rotating while on the modal view.

-=-=-=-=-=-

Bottom line, always call a modal view from the root view controller.



来源:https://stackoverflow.com/questions/3224176/uisplitviewcontroller-pushing-modal-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!