Search code examples
iosxcodeipadpopover

How to create a popover coming from bottom of the screen for iPad


I am looking for a way to implement this kind of popover this kind of popover.

Are there basic iOS commands to generate this style instead of the usual Arrow + Border popover that we see in XCode? Or is there an API to do this kind of thing.

The popover is coming up from the bottom of the screen, just like in the App Store animation sometimes.

Thank you


Solution

  • What you want to do is create a custom UIVIewController with the modal presentation style set to UIModalPresentationFormSheet:

    YourCustomViewController *customVC = [[YourCustomViewController alloc] initWithNib:@"YourCustomViewController" bundle:nil];
    
    customVC.modalPresentationStyle = UIModalPresentationFormSheet;
    
    [self self presentViewController:customVC animated:YES completion:nil];
    

    You will also have to create a toolbar and format it correctly with a "close" or "done" button that will dismiss the view controller