Latest 0.1.2
Homepage https://github.com/yabuzaki/YBAlertController
License MIT
Platforms ios 8.0, requires ARC
Authors

YBAlertController is a Swift library that provide a tidy action sheet and alert

CI Status
Version
License
Platform

Demo

Demo Demo

Easy to use

let alertController = YBAlertController(title: "Menu", message: "Message", style: .ActionSheet)
// let alertController = YBAlertController(style: .ActionSheet)

// add a button
alertController.addButton(UIImage(named: "comment"), title: "Comment", target: self, selector: Selector("tap"))
// add a button with closure
alertController.addButton(UIImage(named: "tweet"), title: "Tweet", action: {
    print("button tapped")
})
// add a button (No image)
alertController.addButton("Open in Safari", target: self, selector: Selector("tap"))

// if you use a cancel Button, set cancelButtonTitle
// alertController.cancelButtonTitle = "Cancel"   

// show alert
alertController.show()

func tap() {
    print("tap")
}

Customize

button icon color

alertController.buttonIconColor = UIColor.blackColor()

Overlay color

alertController.overlayColor = UIColor(red:235/255, green:245/255, blue:255/255, alpha:0.7)

Title

// if title is nil or empty, the title Label is hidden
alertController.title = "Title"
alertController.titleFont = UIFont(name: "Avenir Next", size: 15)
alertController.titleTextColor = UIColor.blueColor()

Message

// if message is nil or empty, the message Label is hidden
alertController.message = "Message"
alertController.messageFont = UIFont(name: "Avenir Next", size: 15)
alertController.messageTextColor = UIColor.blueColor()

Cancel Button

// if cancelButtonTitle is nil or empty, the cancel button is hidden
alertController.cancelButtonTitle = "Cancel"
alertController.cancelButtonFont = UIFont(name: "Avenir Next", size: 15)
alertController.cancelButtonTextColor = UIColor.blueColor()

Button

alertController.buttonFont = UIFont(name: "Avenir Next", size: 15)
alertController.buttonTextColor = UIColor.blueColor()

Touch outside the alert to dismiss

alertController.touchingOutsideDismiss = true
// default, Alert:false ActionSheet:true

Not using a animation

alertController.animated = false

Installation

Manual

Just drag YBAlertController.swift to your project.

CocoaPods

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

pod "YBAlertController"

Usage

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

Requirements

  • iOS 7.0+

Author

Yabuzaki
http://twitter.com/planet12app
http://appstore.com/yutayabuzaki

License

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

Latest podspec

{
    "name": "YBAlertController",
    "version": "0.1.2",
    "summary": "A Swift library to provide a animated action sheet and alert",
    "homepage": "https://github.com/yabuzaki/YBAlertController",
    "license": "MIT",
    "authors": {
        "Yabuzaki": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yabuzaki/YBAlertController.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Classes/**/*"
}

Pin It on Pinterest

Share This