yba

YBAlertController

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

Showing:

Popularity

Downloads/wk

0

GitHub Stars

76

Maintenance

Last Commit

6yrs ago

Contributors

1

Package

Dependencies

0

License

MIT

Categories

Readme

YBAlertController

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.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100