Coder Social home page Coder Social logo

travelc / cnppopupcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from carsonxyz/cnppopupcontroller

0.0 1.0 0.0 6.15 MB

CNPPopupController is a simple and versatile class for presenting a custom popup in a variety of fashions. It includes a many options for controlling how your popup appears and behaves.

License: Other

Ruby 13.87% Objective-C 86.13%

cnppopupcontroller's Introduction

#CNPPopupController

** Updated: Oct, 29 2014 v0.1.2 **

CNPPopupController is a simple and versatile class for presenting a custom popup in a variety of fashions. It includes a many options for controlling how your popup appears and behaves.

Please feel free to contribute to this project, open issues, make suggestions and submit pull-requests. If you use this project in your app, let me know. I'd love to see what you do with it.

Installation

Available in Cocoa Pods

pod 'CNPPopupController'

##Usage

(See sample Xcode project in /CNPPopupControllerExample)

Creating a Popup

Create a popup with custom animations and behaviors. Customizations can also be accessed via properties on the CNPPopupTheme instance:

- (instancetype)initWithTitle:(NSAttributedString *)popupTitle
                 contents:(NSArray *)contents
              buttonItems:(NSArray *)buttonItems
   destructiveButtonItem:(CNPPopupButtonItem *)destructiveButtonItems;

popupTitle only accepts an NSAtributedString object.

contents only accepts an array of NSAttributedString and UIImage objects.

buttonItems only accepts an array of CNPPopupButtonItem objects.

destructiveButtonItem only accepts an CNPPopupButtonItem object.


Note: You may pass nil for any of the initializer properties when creating the popup, but you must assign a theme to the popup before showing it!

A default theme + [CNPPopupTheme defaultTheme] has been created to help you out.


CNPPopupButtonItem allows you to customize the style for each button on a CNPPopupController instance. You may customize button height, color, border width, corner radius, and border color;

Showing a Popup

- (void)presentPopupControllerAnimated:(BOOL)flag;

Dismissing a Popup

- (void)dismissPopupControllerAnimated:(BOOL)flag;

Customization

A CNPPopupTheme instance can be created and assigned to the theme property of a CNPPopupController instance.

@property (nonatomic, strong) UIColor *backgroundColor;

@property (nonatomic, assign) CGFloat cornerRadius;

@property (nonatomic, assign) CGFloat preferredPopupWidth;

@property (nonatomic, assign) CGFloat minimumPopupHeight;

@property (nonatomic, assign) UIEdgeInsets popupContentInsets;

@property (nonatomic, assign) CNPPopupStyle popupStyle;

@property (nonatomic, assign) CNPPopupPresentationStyle presentationStyle;

@property (nonatomic, assign) CNPPopupMaskType maskType;

@property (nonatomic, assign) BOOL shouldDismissOnBackgroundTouch;

@property (nonatomic, assign) CGFloat contentVerticalPadding;

@property (nonatomic, assign) UIStatusBarStyle fullscreenStatusBarStyle;

Notes

Deployment

CNPPopupController works on iOS 7 and iOS 8.

TODO

  • Add 'blur' option for background mask

##Credits CNPPopupController was created by Carson Perrotti, where it's used in the Joist app.

cnppopupcontroller's People

Contributors

coneybeare avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.