TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Apr 2016 |
SPMSupports SPM | ✗ |
Maintained by Oleg Adamov.
AOAlertController
looks like a usual UIAlertController
, but each action item, titles, fonts and colors can be customized.
pod 'AOAlertController'
AOAlertSettings
class as default style for all alert controllerstitleFont
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.
Properties set to individual controllers have a higher priority than properties from AOAlertSettings
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)