https://github.com/kgn/KGModal
KGModal is an easy drop in control that allows you to display any view in a modal popup.
https://github.com/kgn/KGModal
Last synced: 11 days ago
JSON representation
KGModal is an easy drop in control that allows you to display any view in a modal popup.
- Host: GitHub
- URL: https://github.com/kgn/KGModal
- Owner: kgn
- License: mit
- Created: 2012-10-05T23:19:40.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-02-24T10:27:16.000Z (about 9 years ago)
- Last Synced: 2025-03-29T05:10:03.718Z (18 days ago)
- Language: Objective-C
- Homepage:
- Size: 518 KB
- Stars: 454
- Watchers: 31
- Forks: 96
- Open Issues: 11
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
- awesome - KGModal - KGModal is an easy drop in control that allows you to display any view in a modal popup. (etc)
- awesome - KGModal - KGModal is an easy drop in control that allows you to display any view in a modal popup. (etc)
README
KGModal is an easy drop in control that allows you to display any view in a modal popup. The modal will automatically scale to fit the content view and center it on screen with nice animations!

You supply your own content view and KGModal does the rest:
``` obj-c
[[KGModal sharedInstance] showWithContentView:contentView andAnimated:YES];
```There are a couple other options but it's purposely designed to be simple and easy to use:
``` obj-c
// Determines if the modal should dismiss if the user taps outside of the modal view
// Defaults to YES
@property (nonatomic) BOOL tapOutsideToDismiss;// Determines if the close button or tapping outside the modal should animate the dismissal
// Defaults to YES
@property (nonatomic) BOOL animateWhenDismissed;// Determins close button type (None/Left/Right)
// Defaults to Left
@property (nonatomic) KGModalCloseButtonType closeButtonType;// Determines whether close button will display on the left or right
// Defaults to left
@property (nonatomic) KGModalCloseButtonLocation closeButtonLocation;// The background color of the modal window
// Defaults black with 0.5 opacity
@property (strong, nonatomic) UIColor *modalBackgroundColor;// The background display style, can be a transparent radial gradient or a transparent black
// Defaults to gradient, this looks better but takes a bit more time to display on the retina iPad
@property (nonatomic) enum KGModalBackgroundDisplayStyle backgroundDisplayStyle;// The shared instance of the modal
+ (id)sharedInstance;// Set the content view to display in the modal and display with animations
- (void)showWithContentView:(UIView *)contentView;// Set the content view to display in the modal and whether the modal should animate in
- (void)showWithContentView:(UIView *)contentView andAnimated:(BOOL)animated;// Hide the modal with animations
- (void)hide;// Hide the modal with animations,
// run the completion after the modal is hidden
- (void)hideWithCompletionBlock:(void(^)())completion;// Hide the modal and whether the modal should animate away
- (void)hideAnimated:(BOOL)animated;// Hide the modal and whether the modal should animate away,
// run the completion after the modal is hidden
- (void)hideAnimated:(BOOL)animated withCompletionBlock:(void(^)())completion;
```Check out the ExampleApp to see it in action!
###Installation via Cocoapods
Add `pod 'KGModal', '~> 0.0.1'` to your `Podfile` and run `pod` to install.