SliderAlertController
public class SliderAlertController: UIViewController, UIViewControllerTransitioningDelegate, UIViewControllerAnimatedTransitioning
A UIViewController subclass like UIAlertController to display a slider.
-
SliderAlertController’s designated init method.
Declaration
Swift
public init(title: String, message: String? = nil, minimumValue: Float, maximumValue: Float, initialValue: Float, confirmTitle: String? = nil, confirmClosure: @escaping (_ sliderValue: Float) -> Void)
Parameters
title
The title of the slider view.
message
Additional information for the slider view. The default value is nil.
minimumValue
The slider’s minimum value. If this value is not small than maximumValue, this value will be 0 and slider’s maximum value will be 20.
maximumValue
The slider’s maximum value. If this value is not larger than minimumValue, this value will be 20 and slider’s minimum value will be 0.
initialValue
The slider’s initial value.
confirmTitle
The custom title for confirm button. The default is nil. If this value is nil, the title of confirm button is
Confirm
.confirmClosure
A closure to execute after user touch confirm button.
sliderValue
The current value of slider. If
allowsDecimal == false
, its decimal will be moved and justx.0
. -
Not implemented. Don’t init from storyboard/nib file.
Declaration
Swift
required public init?(coder aDecoder: NSCoder)
-
A Boolean value that decides whether remove slider value’s decimal part in view and confirmClosure. The default value is false.
Declaration
Swift
public var allowsDecimal: Bool = false
-
A Dictionary which store the symbol to replace slider value to display on the slider block. For example: I want to express no limit when it’s 0, set a symbol:
floatToSymbolMap[0] = "∞"
.Declaration
Swift
public var floatToSymbolMap: Dictionary<Float, String> = [:]
-
This method is called after the controller has loaded its view hierarchy into memory. But when the controller load its view hierarchy? Before it presents or access any view in the view hierarchy if controller isn’t presented yet. Called only once.
Declaration
Swift
override public func viewDidLoad()
-
Called every time the view controller is about to be presented. Layout is not finished yet.
Declaration
Swift
override public func viewWillAppear(_ animated: Bool)
-
Configure layout of subViews.
Declaration
Swift
override public func viewWillLayoutSubviews()
-
Called every time the view controller is presented.
Declaration
Swift
override public func viewDidAppear(_ animated: Bool)
-
Return animation delegate to provide presentation animation.
Declaration
Swift
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning?
-
Return animation delegate to provide dismiss animation.
Declaration
Swift
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning?
-
Time of transition animation.
Declaration
Swift
public func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval
-
Commit transition animation here.
Declaration
Swift
public func animateTransition(using transitionContext: UIViewControllerContextTransitioning)