fabb
fabb

Reputation: 11745

Present UIActivityViewController in a way that Adapts Correctly to Size Class Changes

The documentation of UIActivityViewController says the following:

On iPad, you must present the view controller in a popover. On iPhone and iPod touch, you must present it modally.

This does not make too much sense since we have Size Classes, and modally presented viewcontrollers adapt their appearance automatically to it (e.g. when we present something as a popover, it will by default be presented as a popover in Size Class Regular, and fullscreen in Size Class Compact).

Presenting the UIActivityViewController in a popover for current Size Class Compact (which should automatically show fullscreen) does not work, the system complains. Presenting it as a popover for current Size Class Regular, and then changing the Size Class via Split Mode / Multitasking results in an empty nav bar and I cannot dismiss the viewcontroller. I should notice that I embedded the UIActivityViewController in a navigation controller.

UIActivityViewController in Split Mode

Any suggestions how to make this responsive?

Upvotes: 1

Views: 313

Answers (1)

mathz
mathz

Reputation: 136

You must not embed the UIActivityViewController in a UINavigationController. I know it doesn't say so in the docs, but that's the only way I got it to work. And then you can actually present it the same way as you would do with any other popover/modal view. And it adapts correctly when you active Split Mode while it is being presented.

Upvotes: 1

Related Questions