1
votes

I use split view in my app, and I present a dialog with UIModalPresentationFormSheet style in popover controller in portrait mode, but after I rotate to landscape mode the dialog disappeared automatically. I don't want it disappear, I would like user could use the dialog after rotation, what can I do?

I found that if I present the dialog in landscape mode for the 1st time, the dialog wouldn't disappear after rotating to portrait mode, it's strange.

Any hints or help would be highly appreciated.

2
I solved this issue in this way: Present the view from the split view controller instead of popover, and the view won't disappear any more whenever I rotate the device.tsing

2 Answers

3
votes

iOS will try and automatically relocate the view, but it depends on where the popover is presented from. From the docs

If the user rotates the device while a popover is visible, the popover controller hides the popover and then shows it again at the end of the rotation. The popover controller attempts to position the popover appropriately for you but you may have to present it again or hide it altogether in some cases. For example, when displayed from a bar button item, the popover controller automatically adjusts the position (and potentially the size) of the popover to account for changes to the position of the bar button item. However, if you remove the bar button item during the rotation, or if you presented the popover from a target rectangle in a view, the popover controller does not attempt to reposition the popover. In those cases, you must manually hide the popover or present it again from an appropriate new position. You can do this in the didRotateFromInterfaceOrientation: method of the view controller that you used to present the popover.

1
votes

I solved this issue in this way: present the view from the split view controller instead of popover, and the view won't disappear any more whenever I rotate the device