• Stars
    star
    453
  • Rank 96,573 (Top 2 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 12 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

KGModal is an easy drop in control that allows you to display any view in a modal popup.

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:

[[KGModal sharedInstance] showWithContentView:contentView andAnimated:YES];

There are a couple other options but it's purposely designed to be simple and easy to use:

// 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.

More Repositories

1

KGNoise

Cocoa noise drawing code plus a ready to go noise view!
Objective-C
776
star
2

InAppSettings

InAppSettings provides a view controller that displays the application's Settings.bundle as it appears in the iPhone settings. Allowing the same preferences in app and in the iPhone settings.
Objective-C
233
star
3

Hark

An example Text to Speech App
Swift
186
star
4

BBlock

Objective-c block categories and subclasses
Objective-C
168
star
5

KGNAutoLayout

Making AutoLayout Easy
Swift
124
star
6

DBPrefsWindowController

A subclass of NSWindowController that provides an easy way to create preference windows.
Objective-C
116
star
7

KGDiscreetAlertView

An easy drop in control that allows you to display a discrete alert in any view.
Objective-C
101
star
8

KGKeyboardChangeManager

A block-based wrapper around the hairy world of iOS keyboard notifications and frames
Objective-C
93
star
9

Spectttator

Spectttator is an Objective-C framework for OSX and iOS that makes it easy to asynchronously interact with the dribbble api.
Objective-C
86
star
10

UIImage-Vector

UIImage category for dealing with vector formats like PDF and icon fonts.
Objective-C
73
star
11

KGNotePad

KGNotePad is a text view complete with lines and torn paper.
Objective-C
71
star
12

PaintCodeExample

An example iPhone app using PaintCode and BBlock
Objective-C
68
star
13

KGPixelBoundsClip

NSImage and UIImage category that provides methods to find the pixel bounds of an image and create a new image clipped to those bounds.
Objective-C
62
star
14

LinenClipView

Adds a linen pattern behind scrollviews like in Apple's Lion apps.
Objective-C
58
star
15

LaunchAtLoginHelper

A helper app to launch a main app at login under sandboxing
Objective-C
57
star
16

EyeTunes

This is a git-svn fork of the EyeTunes project with support for iTunes 10.
Objective-C
34
star
17

KGNPreferredFontManager

Helper class to registering custom fonts for UIFontTextStyle
Swift
21
star
18

JSONMagic

JSONMagic makes it easy to traverse and parse JSON in Swift.
Swift
19
star
19

UIColorCategories

Category methods UIColor
Objective-C
15
star
20

SCKeyRecorder

An Objective-C shortcut recorder for the Mac.
Objective-C
15
star
21

Coaches-Loupe

Upload shots to dribbble.com
C
14
star
22

KGJSON

A simple category around NSJSONSerialization for common JSON string operations
Objective-C
13
star
23

BBBouncePass

An Objective-C library for uploading shots to Dribbble.
Objective-C
12
star
24

KGNGradientView

KGNGradientView is a collection UIView subclasses for linear and radial gradients.
Swift
10
star
25

pygml

A python library for reading and writing gml files.
Python
9
star
26

KGLib

Cocoa library code
Objective-C
8
star
27

KGNCameraController

A camera view build on top of AVFoundation
Objective-C
7
star
28

Gister

Cocoa app for viewing gists.
Objective-C
7
star
29

KGNColor

A collection of UIColor extensions
Swift
7
star
30

BirdHouseKit

An AFNetworking based Twitter library(unfinished)
Objective-C
6
star
31

UIView-KGNAutoLayout

Auto Layout helper methods for common layout operations.
Objective-C
6
star
32

ShapecatcherKit

An Objective-CFramework for the shapecatcher.com api
Objective-C
5
star
33

ImageViewPlus

A Safari Extension that adds formatting to the image view page.
JavaScript
5
star
34

kgn_icons

Icons
Python
5
star
35

KGNThread

A collection of helpful methods that wrap GCD
Swift
4
star
36

NSData-Base64

Git repo of http://cocoawithlove.com/2009/06/base64-encoding-options-on-mac-and.html
Objective-C
4
star
37

IcnsFactory

Create Mac Icons(.icns) from Cocoa
Objective-C
3
star
38

TimeDisplay

A python package for displaying time deltas and runtimes as nice readable strings.
Python
3
star
39

cssutils

git clone
Python
3
star
40

CocoaVerbalExpression

Objective-C
2
star
41

buildly

Continuous build system for iOS apps
Python
2
star
42

sketchpreset

Useful sketch preset files
2
star
43

QLWebloc

This is a failed attempt to display the content of a webpage in quicklook from a .webloc file.
C
2
star
44

KGNUserInterface

A collection of the core user interface resources.
Swift
2
star
45

XCodeSnippets

CodeSnippets for Xcode + a python script to generate a readme so you can see what's in em
Python
2
star
46

pyglang

A python package for translating text with the 'Google AJAX Language API'
Python
2
star
47

KeeganScriptPack

A collection of mel scripts I wrote a while back.
2
star
48

CodingConventions

Name & Code Conventions for 1kLabs, Inc.
2
star
49

growlcoffee

Growl notifications for CoffeeScript
JavaScript
1
star
50

resume

My Resume
1
star
51

StyleGuide

The style guide for 1kLabs, Inc.
1
star
52

mdoc

GitHub markdown documentation generator for Objective-C
Python
1
star
53

PDFImageConverter

Modified code from a ipdfdev.com post
Objective-C
1
star
54

KGNSketchToolkit

Plugins for Sketch
JavaScript
1
star