Skip to content

Commit f2698f8

Browse files
author
David Jonsén
committed
Merge branch 'master' of github.com:davnag/DJSemiModalViewController
2 parents 6b89c03 + 58887f0 commit f2698f8

File tree

3 files changed

+62
-9
lines changed

3 files changed

+62
-9
lines changed

README.md

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
# DJSemiModalViewController
22

3-
[![CI Status](http://img.shields.io/travis/davnag/DJSemiModalViewController.svg?style=flat)](https://travis-ci.org/davnag/DJSemiModalViewController)
4-
[![Version](https://img.shields.io/cocoapods/v/DJSemiModalViewController.svg?style=flat)](http://cocoapods.org/pods/DJSemiModalViewController)
5-
[![License](https://img.shields.io/cocoapods/l/DJSemiModalViewController.svg?style=flat)](http://cocoapods.org/pods/DJSemiModalViewController)
6-
[![Platform](https://img.shields.io/cocoapods/p/DJSemiModalViewController.svg?style=flat)](http://cocoapods.org/pods/DJSemiModalViewController)
7-
83
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.
94

5+
<img src="https://raw.githubusercontent.com/davnag/DJSemiModalViewController/master/Screencast_1.gif" width="320">
6+
107
## Example
118

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

14-
## Requirements
15-
1611
## Installation
1712

1813
DJSemiModalViewController is available through [CocoaPods](http://cocoapods.org). To install
@@ -22,14 +17,72 @@ it, simply add the following line to your Podfile:
2217
pod 'DJSemiModalViewController'
2318
```
2419

20+
## How to use it
21+
22+
```swift
23+
24+
@IBAction func buttonAction(_ sender: Any) {
25+
26+
let controller = DJSemiModalViewController()
27+
28+
controller.title = "Title"
29+
30+
let label = UILabel()
31+
label.text = "An example label"
32+
label.textAlignment = .center
33+
controller.addArrangedSubview(view: label)
34+
35+
controller.presentOn(presentingViewController: self, animated: true, onDismiss: { })
36+
}
37+
38+
```
39+
40+
### Add views to content StackView
41+
42+
```swift
43+
44+
public func addArrangedSubview(view: UIView)
45+
46+
public func addArrangedSubview(view: UIView, height: CGFloat)
47+
48+
public func insertArrangedSubview(view: UIView, at index: Int)
49+
50+
```
51+
52+
### Presenting the ViewController
53+
54+
```swift
55+
56+
public func presentOn(presentingViewController: UIViewController, animated: Bool = true, onDismiss dismissHandler: ViewWillDismiss?)
57+
58+
```
59+
60+
### Settings
61+
62+
```swift
63+
64+
controller.maxWidth = 420
65+
66+
controller.minHeight = 200
67+
68+
controller.titleLabel.font = UIFont.systemFont(ofSize: 22, weight: UIFont.Weight.bold)
69+
70+
controller.closeButton.setTitle("Done", for: .normal)
71+
72+
```
73+
2574
## Author
2675

27-
David Jonsén
76+
David Jonsén
2877

2978
## License
3079

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

33-
## Crediting
82+
## Todo
83+
84+
- Make it possible to turn close methods on/off; close button, tap on background, drag gesture.
85+
86+
## Credits
3487

3588
Photo by rawpixel.com on Unsplash

Screencast_1.gif

2.64 MB
Loading

screenshots_1.png

356 KB
Loading

0 commit comments

Comments
 (0)