Correct way of showing consecutive modalViews

前端 未结 7 1860
没有蜡笔的小新
没有蜡笔的小新 2020-12-23 23:44

I have two views that need to be shown modally, one after the other. This doesn\'t work if we dismiss and show consecutively, like this:

[rootController dism         


        
相关标签:
7条回答
  • 2020-12-24 00:34

    The best solution I found for something like this (if they are all equal children of the parent view) is to patch their views onto a UIScrollView with paging enabled, (you can add a page control at the bottom to make it clear and for navigation) then add the views of the controllers to the page view as they come onscreen, remove as they go offscreen.

    You may also have to dummy call -viewWillAppear and -viewWillDisappear if the controllers rely on this being called. It feels kinda hack-ish when you're coding it all, but once you have it working it looks smooth and natural, and there isn't any of the waiting associated with animating one view out, then animating the next one in once it is gone.

    0 讨论(0)
提交回复
热议问题