iosuiviewcontrolleruimodalpresentationstyleuimodalpresentationcustom

Why UIModalPresentationPageSheet not working ... its always fullscreen


Here is the code snippet for presenting view controllers as Form sheet.Its not working

It always comes as full screen

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"ViewController2"];
    vc.modalPresentationStyle = UIModalPresentationFormSheet;

    [self presentViewController:vc animated:YES completion:NULL];

I even tried ... preferred content size not works...


Solution

  • I think you are trying in iPhone.

    Try this in iPad.

    In iPhone its always full screen.

    In iPad it will look as formsheet as per your expectation

    If you want this to work in iPhone you have to try a third party library or do it yourself