Latest 0.1.2
Homepage https://github.com/davnag/DJSemiModalViewController
License MIT
Platforms ios 9.0
Authors

DJSemiModalViewController is a semi modal presentation dialog that grows with it´s added content. DJSemiModalViewController works for iPhone and iPad. DJSemiModalViewController mimic the design of the default NFC popup dialog.

DJSemiModalViewController

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

DJSemiModalViewController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'DJSemiModalViewController'

How to use it


@IBAction func buttonAction(_ sender: Any) {

    let controller = DJSemiModalViewController()

    controller.title = "Title"

    let label = UILabel()
    label.text = "An example label"
    label.textAlignment = .center
    controller.addArrangedSubview(view: label)

    controller.presentOn(presentingViewController: self, animated: true, onDismiss: { })
}

Add views to content StackView


public func addArrangedSubview(view: UIView)

public func addArrangedSubview(view: UIView, height: CGFloat)

public func insertArrangedSubview(view: UIView, at index: Int)

Presenting the ViewController


public func presentOn(presentingViewController: UIViewController, animated: Bool = true, onDismiss dismissHandler: ViewWillDismiss?)

Settings

controller.automaticallyAdjustsContentHeight = true

controller.maxWidth = 420

controller.minHeight = 200

controller.titleLabel.font = UIFont.systemFont(ofSize: 22, weight: UIFont.Weight.bold)

controller.closeButton.setTitle("Done", for: .normal)

Author

David Jonsén

License

DJSemiModalViewController is available under the MIT license. See the LICENSE file for more info.

Todo

  • Make it possible to turn close methods on/off; close button, tap on background, drag gesture.

Credits

Photo by rawpixel.com on Unsplash

Latest podspec

{
    "name": "DJSemiModalViewController",
    "version": "0.1.2",
    "summary": "Simple semi modal presentation dialog with stacked content.",
    "description": "DJSemiModalViewController is a semi modal presentation dialog that grows with itu00b4s added content. DJSemiModalViewController works for iPhone and iPad. The content is added to a UIStackView that is inside of an UIScrollView that adds scroll if needed. DJSemiModalViewController mimic the design of the standard NFC dialog on iPhone.",
    "homepage": "https://github.com/davnag/DJSemiModalViewController",
    "screenshots": "https://raw.githubusercontent.com/davnag/DJSemiModalViewController/master/screenshots_1.png",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "David Jonseu0301n": "[email protected]"
    },
    "source": {
        "git": "https://github.com/davnag/DJSemiModalViewController.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "9.0"
    },
    "swift_version": "4.0",
    "source_files": "DJSemiModalViewController/Classes/**/*"
}

Pin It on Pinterest

Share This