Latest 0.3.0
Homepage https://github.com/wleofeng/YAlert
License MIT
Platforms ios 9.0
Authors

CI Status
Version
License
Platform

## Introduction

YAlert is a customized alert view controller featuring the ability to specify a banner image, title, message, primary button action and secondary button action.

## Usage

In your view controller, you can initialize and present an AlertViewController instance using the following code:

“`
let alertVC = AlertViewController(bannerImageName: “banner”,
title: “Alert #1”,
message: “This is a message”,
primaryButtonTitle: “Ok”,
secondaryButtonTitle: “Cancel”)
alertVC.tag = 1000
alertVC.delegate = self
alertVC.present()
“`

There are two properties responsible for handling user events when AlertViewController is present.

`delegate` allows your view controller to receive and handle primary button, secondary button, and background tap events.

`tag` allows you to differentiate AlertViewController instances when handling tap events. You may have different event handling logic based on the AlertViewController’s tag number.

“`
extension ViewController: AlertViewControllerDelegate {
func didTapPrimaryButton(_ sender: AlertViewController) {
switch sender.tag {
case 1000:
print(“1000”)
case 2000:
print(“2000”)
default:
print(“no tag”)
}

print(“primary button tapped”)
}

func didTapSecondaryButton(_ sender: AlertViewController) {
print(“secondary button tapped”)
}

func didTapBackground(_ sender: AlertViewController) {
print(“background tapped”)
}
}
“`

## Installation

YAlert is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

“`ruby
pod “YAlert”
“`

## Author

Leo Feng, [email protected]

## License

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

Latest podspec

{
    "name": "YAlert",
    "version": "0.3.0",
    "summary": "A customized alert view controller",
    "description": "A customized alert view controller featuring the ability to specify banner image, title, message, and two user actions.",
    "homepage": "https://github.com/wleofeng/YAlert",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Leo Feng": "[email protected]"
    },
    "source": {
        "git": "https://github.com/wleofeng/YAlert.git",
        "tag": "0.3.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "YAlert/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This