Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Simple semi modal presentation dialog with stacked content

License

NotificationsYou must be signed in to change notification settings

davnag/DJSemiModalViewController

Repository files navigation

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.

Example

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

Installation

DJSemiModalViewController is available throughCocoaPods. To installit, simply add the following line to your Podfile:

pod'DJSemiModalViewController'

How to use it

@IBActionfunc buttonAction(_ sender:Any){letcontroller=DJSemiModalViewController()        controller.title="Title"letlabel=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

publicfunc addArrangedSubview(view:UIView)publicfunc addArrangedSubview(view:UIView, height:CGFloat)publicfunc insertArrangedSubview(view:UIView, at index:Int)

Presenting the ViewController

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

Settings

controller.automaticallyAdjustsContentHeight=true  controller.maxWidth=420controller.minHeight=200controller.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

About

Simple semi modal presentation dialog with stacked content

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp