Latest 1.1
Homepage https://github.com/0legAdamov/AOAlertController
License MIT
Platforms ios 8.2, requires ARC
Authors

[Language]
(https://developer.apple.com/swift)
[CocoaPods compatible]
(https://cocoapods.org/pods/AOAlertController)
[CocoaPods available]
(https://developer.apple.com/swift)

AOAlertController looks like a usual UIAlertController, but each action item, titles, fonts and colors can be customized.

Screenshot

Installation

  • CocoaPods: pod 'AOAlertController'
  • From Source folder

Usage

There are two ways to set up Alerts:

  • Configure AOAlertSettings class as default style for all alert controllers
  • Set up each controller you want to create

AOAlertSettings properties:

  • titleFont
  • messageFont
  • defaultActionFont
  • cancelActionFont
  • destructiveActionFont
  • backgroundColor
  • linesColor
  • titleColor
  • messageColor
  • defaultActionColor
  • destructiveActionColor
  • cancelActionColor
  • tapBackgroundToDismiss

Example:
AOAlertSettings.sharedSettings.backgroundColor = UIColor.redColor() – this means that for all instances of the AOAlertController red background will be set as default.

Changing the properties of a single controller:

Properties set to individual controllers have a higher priority than properties from AOAlertSettings

Configuration

Controller styles

  • AOAlertControllerStyle.Alert
  • AOAlertControllerStyle.ActionSheet

Available controller’s properties

  • actionItemHeight
  • backgroundColor
  • linesColor
  • titleColor
  • titleFont
  • messageColor
  • messageFont
  • tapBackgroundToDismiss

Example:

let alert = AOAlertController(title: "Title", message: nil, style: .Alert)
alert.titleFont = UIFont(name: "AvenirNext-Bold", size: 14)!

Action styles

  • AOAlertActionStyle.Default
  • AOAlertActionStyle.Cancel
  • AOAlertActionStyle.Destructive

Available properties

  • color
  • font

Example:

let actionCancel = AOAlertAction(title: "Cancel", style: .Cancel, handler: nil)
actionCancel.color = UIColor.orangeColor()
alert.addAction(actionCancel)

Full usage Example:

let alert = AOAlertController(title: "Example Alert", message: "All in one", style: .Alert)
let action = AOAlertAction(title: "Default Action", style: .Default) {}
action.color = UIColor.blackColor()
let cancel = AOAlertAction(title: "Cancel", style: .Cancel, handler: nil)
alert.addAction(action)
alert.addAction(cancel)
self.navigationController?.presentViewController(alert, animated: false, completion: nil)

Latest podspec

{
    "name": "AOAlertController",
    "version": "1.1",
    "summary": "AOAlertController looks like a usual UIAlertController, but each action item, titles, fonts and colors can be customized.",
    "homepage": "https://github.com/0legAdamov/AOAlertController",
    "authors": {
        "Oleg Adamov": "[email protected]"
    },
    "source": {
        "git": "https://github.com/0legAdamov/AOAlertController.git",
        "tag": "v1.1"
    },
    "source_files": "Source/*.swift",
    "requires_arc": true,
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "platforms": {
        "ios": "8.2"
    }
}

Pin It on Pinterest

Share This