Latest 1.0.0
Homepage https://github.com/tichise/PopOverDialog
License MIT
Platforms ios 8.0, requires ARC

PopOverDialog

PopOverDialog is a PopOver style dialog view.

Please use it when you want to display confirmation screen without screen transition.

Image

iPhone

PopOverDialog

Examples

for Swift

import UIKit
import PopOverDialog

class SampleViewController: UIViewController, UIAdaptivePresentationControllerDelegate {

    @IBOutlet weak var baseTextView:UITextView?

    override func viewDidLoad() {
        super.viewDidLoad()

        let barButtonItem:UIBarButtonItem = UIBarButtonItem(title: "menu", style: .plain, target: self, action: #selector(SampleViewController.openDialog(sender:)))
        self.navigationItem.rightBarButtonItem = barButtonItem
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }

    @objc public func openDialog(sender:UIBarButtonItem) {

        let popOverDialogViewController = PopOverDialogViewController.instantiate()
        popOverDialogViewController.setButtonText("OK")
        popOverDialogViewController.setMessage("Do you want to send mail?")
        popOverDialogViewController.setSubMessage("When you press OK, the mail will be sent immediately.")

        popOverDialogViewController.setShowsVerticalScrollIndicator(true)
        popOverDialogViewController.setSeparatorStyle(UITableViewCellSeparatorStyle.singleLine)
        popOverDialogViewController.popoverPresentationController?.barButtonItem = sender
        popOverDialogViewController.preferredContentSize = CGSize(width: 300, height:110)
        popOverDialogViewController.presentationController?.delegate = self

        popOverDialogViewController.setMessageFont(UIFont.systemFont(ofSize: 16))
        popOverDialogViewController.setSubMessageFont(UIFont.systemFont(ofSize: 12))
        popOverDialogViewController.setButtonTextFont(UIFont.systemFont(ofSize: 14))
        popOverDialogViewController.setButtonTextColor(UIColor.black)

        popOverDialogViewController.completionHandler = { () -> Void in

        }
        present(popOverDialogViewController, animated: true, completion: nil)
    }

    func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
        return UIModalPresentationStyle.none
    }

    func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
        return UIModalPresentationStyle.none
    }
}

Installation (CocoaPods)

pod PopOverDialog

CocoaPods URL

License

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

Latest podspec

{
    "name": "PopOverDialog",
    "version": "1.0.0",
    "license": "MIT",
    "summary": "PopOverDialog is a PopOver style dialog view.",
    "homepage": "https://github.com/tichise/PopOverDialog",
    "social_media_url": "http://twitter.com/tichise",
    "authors": "Takuya Ichise",
    "source": {
        "git": "https://github.com/tichise/PopOverDialog.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Sources/*.swift",
    "requires_arc": true,
    "resource_bundles": {
        "PopOverDialogStoryboards": [
            "Storyboards/*.storyboard"
        ]
    }
}

Pin It on Pinterest

Share This