STPopup provides STPopupController, which works just like UINavigationController in form sheet/bottom sheet style, for both iPhone and iPad.
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
STPopup.xcodeproj Update to recommended project settings. May 3, 2018
STPopup Update to recommended project settings. May 3, 2018
STPopupExample Update to recommended project settings. May 3, 2018
.gitignore Initial commit Sep 13, 2015
.travis.yml Update to recommended settings. Sep 24, 2017
LICENSE Initial commit Sep 13, 2015 Update README. Aug 18, 2016
STPopup.podspec Bump up version. Sep 24, 2017

STPopup CI Status Version License

STPopup provides STPopupController, which works just like UINavigationController in popup style, for both iPhone and iPad.


  • Extend your view controller from UIViewController, build it in your familiar way.
  • Push/Pop view controller in to/out of popup view stack, and set navigation items by using self.navigationItem.leftBarButtonItem and rightBarButtonItem, just like you are using UINavigationController.
  • Support both "Form Sheet" and "Bottom Sheet" style.
  • Work well with storyboard(including segue).
  • Customize UI by using UIAppearance.
  • Fully customizable popup transition style.
  • Auto-reposition of popup view when keyboard is showing up, make sure your UITextField/UITextView won't be covered by the keyboard.
  • Drag navigation bar to dismiss popup view.
  • Support both portrait and landscape orientation, and both iPhone and iPad.


Used in Sth4Me app

Get Started


platform :ios, '7.0'
pod 'STPopup'


github "kevin0571/STPopup"

Import header file

#import <STPopup/STPopup.h>

Initialize STPopupController

STPopupController *popupController = [[STPopupController alloc] initWithRootViewController:[ViewController new]];
[popupController presentInViewController:self];

Set content size in view controller

@implementation ViewController

- (instancetype)init
    if (self = [super init]) {
        self.title = @"View Controller";
        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Next" style:UIBarButtonItemStylePlain target:self action:@selector(nextBtnDidTap)];
        self.contentSizeInPopup = CGSizeMake(300, 400);
        self.landscapeContentSizeInPopup = CGSizeMake(400, 200);
    return self;

- (void)viewDidLoad
    [super viewDidLoad];
    // Add views here
    // self.view.frame.size == self.contentSizeInPopup in portrait
    // self.view.frame.size == self.landscapeContentSizeInPopup in landscape


Push, pop and dismiss view controllers

[self.popupController pushViewController:[ViewController new] animated:YES];
[self.popupController popViewControllerAnimated:YES]; // Popup will be dismissed if there is only one view controller in the popup view controller stack
[self.popupController dismiss];

Push & Pop

Bottom sheet style

STPopupController *popupController = [[STPopupController alloc] initWithRootViewController:[ViewController new]]; = STPopupStyleBottomSheet;
[popupController presentInViewController:self];

Bottom Sheet

Customize popup transition style

#pragma mark - STPopupControllerTransitioning

- (NSTimeInterval)popupControllerTransitionDuration:(STPopupControllerTransitioningContext *)context
    return context.action == STPopupControllerTransitioningActionPresent ? 0.5 : 0.35;

- (void)popupControllerAnimateTransition:(STPopupControllerTransitioningContext *)context completion:(void (^)())completion
    UIView *containerView = context.containerView;
    if (context.action == STPopupControllerTransitioningActionPresent) {
        containerView.transform = CGAffineTransformMakeTranslation(containerView.superview.bounds.size.width - containerView.frame.origin.x, 0);
        [UIView animateWithDuration:[self popupControllerTransitionDuration:context] delay:0 usingSpringWithDamping:1 initialSpringVelocity:1 options:UIViewAnimationOptionCurveEaseInOut animations:^{
            context.containerView.transform = CGAffineTransformIdentity;
        } completion:^(BOOL finished) {
    else {
        [UIView animateWithDuration:[self popupControllerTransitionDuration:context] delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
            containerView.transform = CGAffineTransformMakeTranslation(- 2 * (containerView.superview.bounds.size.width - containerView.frame.origin.x), 0);
        } completion:^(BOOL finished) {
            containerView.transform = CGAffineTransformIdentity;

Blur background

STPopupController *popupController = [[STPopupController alloc] initWithRootViewController:[PopupViewController1 new]];
if (NSClassFromString(@"UIBlurEffect")) {
    UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
    popupController.backgroundView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];

Dismiss by tapping background

popupController = [[STPopupController alloc] initWithRootViewController:self];
[popupController.backgroundView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundViewDidTap)]];

Customize UI

[STPopupNavigationBar appearance].barTintColor = [UIColor colorWithRed:0.20 green:0.60 blue:0.86 alpha:1.0];
[STPopupNavigationBar appearance].tintColor = [UIColor whiteColor];
[STPopupNavigationBar appearance].barStyle = UIBarStyleDefault;
[STPopupNavigationBar appearance].titleTextAttributes = @{ NSFontAttributeName: [UIFont fontWithName:@"Cochin" size:18], NSForegroundColorAttributeName: [UIColor whiteColor] };
[[UIBarButtonItem appearanceWhenContainedIn:[STPopupNavigationBar class], nil] setTitleTextAttributes:@{ NSFontAttributeName:[UIFont fontWithName:@"Cochin" size:17] } forState:UIControlStateNormal];

Customize UI

Auto-reposition when keyboard is showing up
No codes needed for this feature

Drag to dismiss
No codes needed for this feature
Drag to dismiss

Handle orientation change
No codes needed for this feature
Orientation change

For more details, please download the example project.