presentModalViewController does nothing

穿精又带淫゛_ 提交于 2019-12-06 06:33:11

问题


I have a UIViewController (parent) that calls presentModalViewController with another UIViewController (child) on viewDidLoad.

If parent doesn't have a UINavigationController, then presentModalViewController does nothing. If it has a UINavigationController, then presentModalViewController shows child as expected.

Is this the standard behavior of presentModalViewController or is there something else at play here?


回答1:


It is because you are presenting it in viewDidLoad, try presenting it in viewDidAppear.




回答2:


Debug your app and look if the child-view isn't nil, if it's nil then it's not standard behavior, otherwise I think it's a standard behavior..

Hope, it helps..



来源:https://stackoverflow.com/questions/4059790/presentmodalviewcontroller-does-nothing

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