Latest 1.1.1
Homepage https://github.com/HituziANDO/MKAPopup
License MIT
Platforms ios 9.3, requires ARC
Authors

MKAPopup

MKAPopup is simple and customizable popup view written in Swift for iOS.

Objective-C version is here.

Requirements

  • Swift 4.2+

Installation

CocoaPods

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

pod "MKAPopup"

Manual Installation

  1. Download latest MKAPopup framework and copy it into your Xcode project
  2. Open the "General" panel
  3. Click on the + button under the "Embedded Binaries" section
  4. After click "Add Other…", choose MKAPopup.framework

Quick Usage

Let’s see following code.

import MKAPopup

...

// Creates your content view.
let contentView = ...YOUR CONTENT VIEW CREATION...
// Creates a popup using your content view.
let popup       = MKAPopup(contentView: contentView)

// Customizes...

// Title (default is nil)
popup.popupView.titleLabel.text = "About Swift"

// Title Text Color (default is system default color)
popup.popupView.titleLabel.textColor = .white

// Title Font (default is system default font)
popup.popupView.titleLabel.font = UIFont.boldSystemFont(ofSize: 20.0)

// Title Text Padding (default is (16, 16, 16, 16))
popup.popupView.titleLabel.padding = UIEdgeInsets(top: 24.0, left: 16.0, bottom: 24.0, right: 16.0)

// Popup Background Color (default is white)
popup.popupView.backgroundColor = UIColor(red: 0, green: 0.5, blue: 1.0, alpha: 1.0)

// Popup Corner Radius (default is 5)
popup.popupView.layer.cornerRadius = 20.0

// Popup Size (default is (300, 400))
popup.popupSize = CGSize(width: 320.0, height: 480.0)

// Overlay Color (default is black with alpha=0.4)
popup.backgroundColor = UIColor.black.withAlphaComponent(0.8)

// Can hide when a user touches up outside a popup (default is true)
popup.canHideWhenTouchUpOutside = false

// Showing Animation (default is fade)
popup.showingAnimation = .fade

// Hiding Animation (default is fade)
popup.hidingAnimation = .fade

// Animation Duration (default is 0.3)
popup.duration = 0.3

// Delegate
popup.delegate = self

// Shows the popup.
popup.show()

...

// Hides the popup.
popup.hide()

Animation Types

Fade

SlideUp

SlideDown

SlideLeft

SlideRight

Latest podspec

{
    "name": "MKAPopupObjC",
    "version": "1.1.1",
    "summary": "MKAPopupObjC is a view library.",
    "description": "MKAPopupObjC is simple and customizable popup view written in Objective-C for iOS.",
    "homepage": "https://github.com/HituziANDO/MKAPopup",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Hituzi Ando": "[email protected]"
    },
    "platforms": {
        "ios": "9.3"
    },
    "source": {
        "git": "https://github.com/HituziANDO/MKAPopup.git",
        "tag": "1.1.1"
    },
    "source_files": "MKAPopupObjC/MKAPopupObjC/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This