GithubHelp home page GithubHelp logo

s2339956 / popupcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from daisuke310vvv/popupcontroller

0.0 1.0 0.0 1.49 MB

PopupController is a controller for showing temporary popup view.

License: MIT License

Swift 97.79% Ruby 2.21%

popupcontroller's Introduction

PopupController

CI Status Version License Platform

PopupController is a controller for showing temporary popup view.

Demo

Try PopupController on Appetize.io

Installation

CocoaPods

pod 'PopupController'

Carthage

Future

Usage

Before use,
Every ViewController which is added on the PopupController must conform to PopupContentViewController protocol.

class AnyPopupViewController: UIViewController, PopupContentViewController {

	// Do something...

	private var popupSize: CGSize // define the size for showing popup view size.

	// PopupContentViewController Protocol
    func sizeForPopup(popupController: PopupController, size: CGSize, showingKeyboard: Bool) -> CGSize {
	    return popupSize
	}
}

Then, show popup

PopupController
    .create(self)
    .show(AnyPopupViewController())

With some custom.

PopupController
    .create(self)
    .customize(
        [
            .Animation(.FadeIn), 
            .Layout(.Top), 
            .BackgroundStyle(.BlackFilter(alpha: 0.7))
        ]
    )
    .show(AnyPopupViewController())

With Handler

PopupController
    .create(self)
    .customize(
        [
            .Scrollable(false), 
            .DismissWhenTaps(true)
        ]
    )
    .didShowHandler { popup in
        // Do something
    }
    .didCloseHandler { _ in
        // Do something
    }
    .show(AnyPopupViewController())

If you use PopupController instance, do like this below

let popup = PopupController
    .create(self)
    .customize(
        [
            .Animation(.SlideUp)
        ]
    )
    .didShowHandler { popup in
        // Do something
    }
    .didCloseHandler { _ in
       // Do something
    }

popup.show() // show popup
popup.dismiss() // dismiss popup

Customization

public enum PopupCustomOption {
    case Layout(PopupController.PopupLayout)
    case Animation(PopupController.PopupAnimation)
    case BackgroundStyle(PopupController.PopupBackgroundStyle)
    case Scrollable(Bool)
    case DismissWhenTaps(Bool)
    case MovesAlongWithKeyboard(Bool)
}

License

PopupController is available under the MIT lincense. See the LINCENSE file for more info.

popupcontroller's People

Contributors

daisuke310vvv avatar maziyarpanahi avatar omatty198 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.