8

I'm trying to translate some Objective-C code to SWIFT.

I'm loading a UIViewController as a Form Sheet. Here's the code in objective-c:

generalPopup.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
generalPopup.modalPresentationStyle = UIModalPresentationFormSheet;

Here's the code in Swift:

generalPopup.modalTransitionStyle = UIModalTransitionStyle.CoverVertical
generalPopup.modalPresentationStyle = UIModalPresentationStyle.FormSheet

In Objective-C the view is shown as a FormSheet. In swift, the CoverVertical is maintained, but the view takes the whole screen instead of being shown as FormSheet.

Just as a reminder, according to Apple a FormSheet is:

A view presentation style in which the width and height of the presented view are smaller than those of the screen and the view is centered onscreen. If the device is in a landscape orientation and the keyboard is visible, the position of the view is adjusted upward so the view remains visible. All uncovered areas are dimmed to prevent the user from interacting with them.

Mundi
  • 77,414
  • 17
  • 110
  • 132
YogevSitton
  • 9,578
  • 10
  • 55
  • 90

1 Answers1

1

Continuing your quote from the docs:

In a horizontally compact environment, this option behaves the same as UIModalPresentationFullScreen.

It seems you have a "horizontally compact environment". Check you storyboard settings in the swift project.

Mundi
  • 77,414
  • 17
  • 110
  • 132