| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
STPopup provides STPopupController, which works just like UINavigationController in popup style, for both iPhone and iPad.
Features:
platform :ios, '7.0'
pod '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
}
@endPush, 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];Bottom sheet style
STPopupController *popupController = [[STPopupController alloc] initWithRootViewController:[ViewController new]];
popupController.style = STPopupStyleBottomSheet;
[popupController presentInViewController:self];Blur background
STPopupController *popupController = [[STPopupController alloc] initWithRootViewController:[PopupViewController1 new]];
if (NSClassFromString(@"UIBlurEffect")) {
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
popupController.backgroundView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
}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];Auto-reposition when keyboard is showing up
No codes needed for this feature

Drag to dismiss
No codes needed for this feature

Handle orientation change
No codes needed for this feature

For more details, please download the example project.
| Back | FazBrowse Home | New Git URL |